This topic describes features available in solidDB® to set a connection timeout.
Connection timeout means response timeout of any JDBC call invoking data transmission over a connection socket. If the response message is not received within the time specified, an I/O exception is thrown. The JDBC standard (2.0/3.0) does not support setting of the connection timeout. solidDB® has introduced two ways for doing that: one using a non-standard driver manager extension method and the other one using the property mechanisms. The time unit in either case is one millisecond.
Driver Manager Method get/setConnectionTimeout()
The following example illustrates the solution. The effect of the setting is immediate. This allows to set the timeout to zero if you want to force-disconnect.
//Import Solid JDBC: import solid.jdbc.*;
//Define the connection: solid.jdbc.SolidConnection conn = null;
//Cast to SolidConnection in order to use Solid-specific methods: conn = (SolidConnection)java.sql.DriverManager. getConnection(sCon);
//Set connection timeout in milliseconds: conn.setConnectionTimeout(3000);