Connection Validation Behavior in Presto JDBC Driver , Is Lazy Validation Intentional? #26569
Unanswered
imsayari404
asked this question in
Q&A
Replies: 1 comment
-
|
issue : #26596 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The Presto JDBC driver uses lazy connection validation : getConnection() succeeds without performing network validation, and actual connectivity is only verified during the first metadata or query operation. This behaviour differs from other JDBC drivers like MySQL, which perform eager validation at getConnection() time.
Testing & Findings
I tested both Presto JDBC driver (v0.295) and MySQL Connector/J (v9.2.0) with wrong and correct ports to compare their validation behaviour.
presto-jdbc :
// Wrong port: 843 instead of 443
String wrongPortUrl = "jdbc:presto://host.example.com:843/?SSL=true";
String correctPortUrl = "jdbc:presto://host.example.com:443/?SSL=true";
MySQL JDBC:
// Wrong port: 32662 instead of 32661
String wrongPortUrl = "jdbc:mysql://host.example.com:32662/db?useSSL=true";
String correctPortUrl = "jdbc:mysql://host.example.com:32661/db?useSSL=true";
Results
Presto JDBC Driver (Lazy Validation):
MySQL JDBC Driver (Eager Validation):
Observation :
Presto: getConnection() and getMetaData() succeed for both valid and invalid ports. Network validation only occurs when calling getDatabaseProductVersion() or executing queries.
MySQL: getConnection() fails immediately with wrong port. Connection validation happens during the getConnection() call itself.
Is Lazy Validation Intentional for Presto JDBC Driver?
Beta Was this translation helpful? Give feedback.
All reactions