Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@olavloite
Copy link

Adds the actual JDBC Driver, including the service registration file for the driver.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 29, 2019
@olavloite olavloite requested a review from kolea2 July 29, 2019 10:09
@olavloite olavloite force-pushed the spanner-jdbc-27-jdbc-driver branch from 68038e2 to 0dd1027 Compare July 30, 2019 08:54
@olavloite olavloite requested a review from kolea2 July 30, 2019 08:54
}
private static JdbcDriver registeredDriver;

static void register() throws SQLException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one last question. How come this is different than the class loading done in JdbcDataSource?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JdbcDataSource is not responsible for registering the JDBC driver. That is the responsibility of the driver itself, and is done automatically when the driver class (JdbcDriver) is loaded. In most newer environments this is done automatically thanks to the service registration in META-INF/services/java.sqlDriver. The JdbcDataSource does a manual load of the driver class to be 100% certain that the driver is loaded and registered, although in most cases it will be redundant.

@olavloite olavloite merged commit 666efd5 into googleapis:spanner-jdbc Jul 31, 2019
olavloite added a commit to olavloite/google-cloud-java that referenced this pull request Aug 5, 2019
* add JdbcDriver

* add jdbc DataSource implementation

* removed information from test connection url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants