Connection timeout for DriverManager getConnection

后端 未结 6 1963
梦毁少年i
梦毁少年i 2020-11-29 01:23

I am trying to connect to DB using the standard JDBC way

connection = DriverManager.getConnection(url, username, password);

Is there a maxi

6条回答
  •  孤街浪徒
    2020-11-29 02:01

    Here is how to do it with Connector/J MYSQL driver:

    String qqq = "jdbc:mysql://localhost/Test?connectTimeout=TIME_IN_MILLIS";
    conn = DriverManager.getConnection(qqq, db_user, db_pass);
    

    It worked for me after setLoginTimeout() did nothing.

提交回复
热议问题