-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Support JDBC validate connection #24127
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
Support JDBC validate connection #24127
Conversation
79d3243 to
639e787
Compare
93a3aca to
499786a
Compare
499786a to
693699c
Compare
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/StatementClientV1.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/StatementClientFactory.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/StatementClientV1.java
Outdated
Show resolved
Hide resolved
client/trino-client/src/main/java/io/trino/client/StatementClientV1.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/test/java/io/trino/jdbc/TestTrinoDriver.java
Outdated
Show resolved
Hide resolved
365474f to
ba029a4
Compare
ba029a4 to
23a00d0
Compare
client/trino-client/src/main/java/io/trino/client/StatementClientV1.java
Outdated
Show resolved
Hide resolved
f3d16fb to
5615c84
Compare
da5b8f5 to
3023767
Compare
client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/test/java/io/trino/jdbc/TestAsyncResultIterator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/dispatcher/QueuedStatementResource.java
Outdated
Show resolved
Hide resolved
8806417 to
a4976d5
Compare
client/trino-client/src/main/java/io/trino/client/StatementClientV1.java
Outdated
Show resolved
Hide resolved
a4976d5 to
d618ed0
Compare
|
I'd prefer to not to add this to the StatementClientV1 itself - it's not needed there and the changes to remove the query from the constructor are wrong. Instead, I'd just add it to JDBC only and use the fact that, TrinoConnection has the authenticated client already. With it, it's just a matter of: You can add this alone to |
But this undercut the pattern that JDBC delegates function calls to Given the fact that |
|
The reason to control this behavior through a property was indeed the extra round-trip. The argument was that since creating connections in Trino is basically free currently, there may be client applications that create connections for every query and in a scenario like that, adding an extra round-trip would introduce a performance regression. |
|
@aalbu If the goal is to implement |
|
The goal is to make Trino play nicer with BI tools. Most JDBC drivers ensure that connections are valid at creation time and also let you do a proper validity check). BI tools tend to misbehave when the behavior is different (i.e. you can create connections with wrong credentials or calling |
|
Do we know whether |
Fixing
|
d8f28d3 to
2e55865
Compare
|
I've applied some structural changes and cleanups and squashed commits together. |
|
@mosabua PTAL at jdbc.md change |
|
@xsgao-github why have you added a merge commit here? We are not doing that |
d67fed3 to
2e55865
Compare
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.
Minor doc changes and then good to go.
|
|
As part of docs fix also please rebase and squash commits .. and do that manually .. as you saw the GitHub UI messes that up with a merge commit ;-) |
|
@xsgao-github it's not needed |
2e55865 to
7e01309
Compare
|
Ship it @wendigo ! |
|
@xsgao-github there is no such thing as a Trino LTS release. Please keep questions relevant to Trino and related open source projects. |

Description
HEAD /v1/statement, this allows client to validate authentication without submitting a query.validateConnectionproperty that allows validating connection when making a JDBC connection - SQLException does not return the correct SQLState when making connection failed #16504Connection.isValid(int)- fix JDBC Connection.isValid(int) should verify access token expiration #22684Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: