I need to set the socketTimeout
property when establishing the connection from database using jdbc. I am using sqljdbc4
to connect with SQL SERVER 2008 R2. Here is my code.
java.util.Properties info = new java.util.Properties();
info.setProperty("user", informationStoreDefinition.getProperties().get(USER));
info.setProperty("password", informationStoreDefinition.getProperties().get(PASSWORD));
info.setProperty("socketTimeout", "10");
info.setProperty("loginTimeout", "10");
testConnection = DriverManager.getConnection(informationStoreDefinition.getProperties().get(DB_URL), info);
I did not find the socket timeout effective in my case. I have set it for 10 seconds but it throws time-out after 30 seconds. I will set the time out to 30 seconds but that need to work at 10 seconds first.