0
I'm try to connect to Snowflake by Snowflake JDBC Driver lib (snowflake-jdbc-3.9.1.jar). And I set the connection parameter 'loginTimeout' to 5 seconds and 'networkTimeout' to 200 seconds. The user is invalid user. Below is the code:
Properties properties = new Properties();
properties.put("user", "test");
properties.put("password", "000000");
properties.put("account", "test");
properties.put("warehouse", "unknown");
properties.put("db", "db");
properties.put("schema", "public"); // This is usually 'public'
properties.put("loginTimeout", 5); // Time in seconds to wait for Snowflake to accept login
properties.put("networkTimeout", 200); // Time in seconds to wait for make the TCP/IP connection to Snowflake
properties.put("queryTimeout", queryTimeout); // Time in seconds to wait for the SQL to get the usage to respond.
properties.put("tracing", tracing); // OFF , SEVERE , WARNING , INFO , CONFIG , FINE , FINER , FINEST , ALL
// Make the connection string to Snowflake
String connectStr = "jdbc:snowflake://test.us-east-1.snowflakecomputing.com";
Connection connection = null;
// Try to connect using the connection parameters
try {
connection = DriverManager.getConnection(connectStr, properties);
} catch (Exception e) {
m_logger.error("Snowflake connection error: " + e.getMessage());
m_lastDownloadError = e.getMessage();
}
Of course, I can't login successfully. But the log shows that the parameter 'loginTimeout' does not work. Below is the log message:
[2019-09-19 02:21:36] [SEVERE] Stop retrying since elapsed time due to network issues has reached timeout. Elapsed: 360,385(ms), timeout: 5,000(ms)
Why does the program use more time than I set?
(1) I’m not sure what you’re saying. How long does you routine take? (2) Is your code catching an exception? What is the message? (3) Can you explain why your routine is timing out and not just getting an error because the user name is invalid? – Scott – 2019-09-25T21:46:00.170
In addition to being unclear, this is (arguably) off-topic. – Scott – 2019-09-26T19:28:06.927