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

Bump mysql-connector to 6.x #18

Closed
MartinSahlen opened this issue Sep 19, 2016 · 4 comments
Closed

Bump mysql-connector to 6.x #18

MartinSahlen opened this issue Sep 19, 2016 · 4 comments

Comments

@MartinSahlen
Copy link

Can you bump the sql-connector to the latest version? We were happy with your library because it allowed us to get away from this approach here (http://labs.unacast.com/2016/02/18/cloud-sql-on-google-container-engine/), but as we are now bumping our dependencies it fails and we seem forced to revert back, increasing build time and container complexity / responsibilities.

The error is java.lang.NoClassDefFoundError: com/mysql/jdbc/SocketFactory. I believe it is pretty simple - the functionality is still present in 6.X, it just put in another package: com.mysql.cj.api.io.SocketFactory

On a side note: Is there any rationale why the com.google.cloud.sql.mysql.SslSocketFactory is package local? It would be a lot easier for me to just rewrite this by creating my own SocketFactory without having to copy and duplicate your SSL and authentication stuff.

@vadimberezniker
Copy link
Contributor

I've replied on the pull request -- let's continue the conversation there.

The methods in SslSocketFactory are package private on purpose since the API of that class can change any time without notice. If it was not package private, we would have to be careful about any method changes. It's not likely that the MySQL socket factory interface is going to change again any time soon so I don't see a lot of value in exposing SslSocketFactory outside the library. Let me know if you have some other uses in mind.

@MartinSahlen
Copy link
Author

Thanks for your reply!

The methods / API of the SslSocketFactory are mostly private / unused / unneeded by other classes - the only one that really seems to be needed for me to implement a SocketFactory is this:

 this.socket = SslSocketFactory.getInstance().create(instanceName);

This basically seems to be a singleton pattern, so I don't see a huge problem in exposing this functionality to other classes - it returns a socket that is properly authenticated to be used (in this case) for SQL. If this was available it would be easy to create my own SocketFactory without having to pull request here. The real heavy lifting ins done in SslSocketFactory, not in your implementation SocketFactory. Or am I completely missing the point?

vadimberezniker added a commit to vadimberezniker/cloud-sql-mysql-socket-factory that referenced this issue Oct 3, 2016
SocketFactory interface. This was done by splitting the project into
multiple modules:
  core - mysql driver agnostic library code
  connector-j-5 - module for the 5.x version of Connector/J
  connector-j-6 - module for the 6.x version of Connector/J

The connector-j-6 module publishes a new artifact with id
'mysql-socket-factory-connector-j-6'.

Fixes GoogleCloudPlatform#18.
vadimberezniker added a commit to vadimberezniker/cloud-sql-mysql-socket-factory that referenced this issue Oct 7, 2016
SocketFactory interface. This was done by splitting the project into
multiple modules:
  core - mysql driver agnostic library code
  connector-j-5 - module for the 5.x version of Connector/J
  connector-j-6 - module for the 6.x version of Connector/J

The connector-j-6 module publishes a new artifact with id
'mysql-socket-factory-connector-j-6'.

Fixes GoogleCloudPlatform#18.
vadimberezniker added a commit to vadimberezniker/cloud-sql-mysql-socket-factory that referenced this issue Oct 7, 2016
SocketFactory interface. This was done by splitting the project into
multiple modules:
  core - mysql driver agnostic library code
  connector-j-5 - module for the 5.x version of Connector/J
  connector-j-6 - module for the 6.x version of Connector/J

The connector-j-6 module publishes a new artifact with id
'mysql-socket-factory-connector-j-6'.

Fixes GoogleCloudPlatform#18.
vadimberezniker added a commit to vadimberezniker/cloud-sql-mysql-socket-factory that referenced this issue Oct 7, 2016
SocketFactory interface. This was done by splitting the project into
multiple modules:
  core - mysql driver agnostic library code
  connector-j-5 - module for the 5.x version of Connector/J
  connector-j-6 - module for the 6.x version of Connector/J

The connector-j-6 module publishes a new artifact with id
'mysql-socket-factory-connector-j-6'.

Fixes GoogleCloudPlatform#18.
@vadimberezniker
Copy link
Contributor

@MartinSahlen
Copy link
Author

Great, thanks! Will check it out.

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

2 participants