Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDOException: No handler for this scheme #14

Closed
cklmercer opened this issue Oct 30, 2018 · 1 comment
Closed

PDOException: No handler for this scheme #14

cklmercer opened this issue Oct 30, 2018 · 1 comment

Comments

@cklmercer
Copy link

Background

  • I am using this package with Laravel 5.7
  • I have resolved the issue describe below. This is just an informative ticket.

Issue

After configuring my first pipeline I was greeted with the following error when attempting to execute it.

PDOException with message 'SQLSTATE[HY000] [2002] No handler for this scheme'

Details

The default database config for Laravel 5.7 sets the unix_socket option to an empty string. Whenever this package attempts to establish a connection it only checks to see if a socket option `isset. It doesn't check to see if the provided option is truthy.

This results in it generating adns option that looks something like the following: mysql:unix_socket=;dbname=default. I'm not sure if that's ever considered a valid option, however it certainly sent me down the rabbit hole.

Solution

The simplest solution, for me, was to completely remove the unix_socket option from my database configuration. Doing so resulted in a dns option that looks more like the following: mysql:host=127.0.0.1;port=3306;dbname=default which worked great for me.

I'm not sure if this is documented somewhere. I might have missed an aside or skimmed over something I should have read thoroughly, however, I wanted to share my findings just in case anybody else runs into this issue.

Code References

The following is the code that checks to see if a unix_socket option has been provided. The same method also checks for other settings, such as a host, port, etc. As you can see, it only checks to see if the option isset, and it does not check to ensure a non-empty string is provided. (Again, I'm not sure if an empty string is ever acceptable. If it isn't, it would be great to see this check extended to also check for truthiness.)

https://github.com/leomarquine/php-etl/blob/master/src/Database/Connectors/MySqlConnector.php#L36-L38

@cklmercer cklmercer changed the title Unix Socket - Error: No handler for this scheme PDOException: No handler for this scheme Oct 30, 2018
@cklmercer
Copy link
Author

Looks like this is a duplicate of #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant