-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: enable native JDBC connections #28
Conversation
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.
Overall LGTM. Maybe we should add in more pg-jdbc testing, but it doesn't have to be done in this PR.
DriverManager.getConnection( | ||
String.format("jdbc:postgresql://localhost:%d/", testEnv.getPort()))) { | ||
try (ResultSet resultSet = | ||
connection.createStatement().executeQuery("SELECT 'Hello World!'")) { |
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.
Will this work with all other queries as well using pg-jdbc? I assume the wireprotocol is the same for pg-jdbc?
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.
Yes, the wireprotocol is the same for pg-jdbc, so yes it will in theory work with other queries. However:
- The pg-jdbc driver uses binary format for many query parameter types, so we need to support that for parameterized queries to work. That is included in feat: add support incoming binary values #27
- The pg-jdbc driver sends
timestamp
anddate
parameter values as untyped parameters. Support for that is also included in feat: add support incoming binary values #27 (only for timestamp at this moment, as we currently do not support date). - The pg-jdbc driver prefers the extended query mode over simple query mode (which is normally used in psql). That will probably also need some tweaking.
Yeah, I'll bring in a lot more test cases in separate PRs. #23 already contains a lot of test cases, but I decided to split it into several smaller PRs so it would be easier to review. Many of the test cases in #23 will only succeed once #27 has been merged, as the tests use parameterized queries and the pg-jdbc driver sends parameter values in binary format as opposed to the default text format used by psql. |
Enables connections to PgAdapter from the native PostgreSQL JDBC driver. This requires a couple of minor tweaks to the startup protocol:
UTF8
instead ofutf8
).standard_conforming_strings
should beon
oroff
(nottrue
orfalse
).