A number of features are available in solidDB to set a connection timeout (the response timeout of any JDBC call that invokes 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 the connection timeout. However, solidDB has implemented two ways to set a connection timeout:
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);