-
Notifications
You must be signed in to change notification settings - Fork 1.1k
spanner-jdbc: Step 27 - JdbcDriver #5912
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
spanner-jdbc: Step 27 - JdbcDriver #5912
Conversation
...ib/google-cloud-spanner-jdbc/src/test/java/com/google/cloud/spanner/jdbc/JdbcDriverTest.java
Outdated
Show resolved
Hide resolved
...cloud-contrib/google-cloud-spanner-jdbc/src/main/resources/META-INF/services/java.sql.Driver
Show resolved
Hide resolved
68038e2 to
0dd1027
Compare
...ib/google-cloud-spanner-jdbc/src/test/java/com/google/cloud/spanner/jdbc/JdbcDriverTest.java
Show resolved
Hide resolved
| } | ||
| private static JdbcDriver registeredDriver; | ||
|
|
||
| static void register() throws SQLException { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
* add JdbcDriver * add jdbc DataSource implementation * removed information from test connection url
Adds the actual JDBC Driver, including the service registration file for the driver.