Originally posted by imsayari404 November 10, 2025
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):
========== WRONG PORT ==========
✓ getConnection() SUCCEEDED in 432ms
✓ getMetaData() SUCCEEDED in 0ms
✗ getDatabaseProductVersion() FAILED
Error: java.net.ConnectException: Connection refused
========== CORRECT PORT ==========
✓ getConnection() SUCCEEDED in 3ms
✓ getMetaData() SUCCEEDED in 0ms
✗ getDatabaseProductVersion() FAILED
Error: SSLHandshakeException (certificate issue - testing from external client)
MySQL JDBC Driver (Eager Validation):
========== WRONG PORT ==========
✗ getConnection() FAILED immediately
Error: CommunicationsException: Communications link failure
========== CORRECT PORT ==========
✓ getConnection() SUCCEEDED in 3719ms
✓ getMetaData() SUCCEEDED in 1ms
✓ getDatabaseProductVersion() SUCCEEDED in 0ms
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?
Discussed in https://github.com/orgs/prestodb/discussions/26569
Originally posted by imsayari404 November 10, 2025
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?