Programmer Guide : solidDB® JDBC Driver : solidDB® JDBC Driver extensions : Non-standard JDBC connection properties
  
Non-standard JDBC connection properties
The following connection properties can be used to attain connection-specific behavior.
Statement cache property
Timeout properties
Appinfo property
Transparent connectivity (TC) properties
Socket linger connection properties
Shared memory access (SMA) connection property
Catalog and schema name properties
Catalog and schema name properties
Encryption properties
Setting connection properties with the URL string
Statement cache property
The solidDB® JDBC driver provides a property for setting the value of the connection statement cache.
The name of the property is StatementCache and the default size of the cache is 8. The valid value range is 1 to 512 (inclusive). If the value exceeds the range, the driver silently forces the value either to 1 or 512.
Below is an example on how to use the property.
// create a Solid JDBC driver instance Class.forName("solid.jdbc.SolidDriver");
// create a new Properties instance and insert a value for
// StatementCache property
java.util.Properties props = new java.util.Properties();
props.put("StatementCache","32");
// define the connection string to be used
String sCon="jdbc:solid://localhost:1315/uname1/pwd1";
// get the Connection object with a statement cache of 32 java.sql.Connection conn =
    java.sql.DriverManager.getConnection(sCon, props);
Timeout properties
The timeouts listed in the sections below can be set as connection properties.
Connection timeout property (solid_connection_timeout_ms)
Using the property “solid_connection_timeout_ms”, you can set the connection timeout value (in milliseconds). The property must be set before getting a new connection. Once a connection object is created, changing the property value has no effect.
Login timeout property (solid_login_timeout_ms)
Using the property “solid_login_timeout_ms”, you can set the timeout (in milliseconds) for opening of a connection.
You can use also the method DriverManger.setLoginTimeout(seconds) to set the login timeout. This is a standard-compliant method.
Idle Timeout Property (solid_idle_timeout_min)
Using the property “solid_idle_timeout_min”, you can set the timeout (in minutes) that fires when a connection has been idle for a longer time than specified (in minutes).
If the property value is not set, the server-side setting of the configuration parameter ConnectTimeOut applies. The factory value is 480 minutes. 0 means “infinite timeout” (never expires).
Example
The following example shows how to set a connect timeout using the “solid_connection_timeout_ms” property.
// Set connection timeout with "solid_connection_timeout_ms" property //
public class Test {
  public static void main( String args[] ){
  // create property object
  Properties props = new Properties();
  // put username and password in the properties
  props.put("user", "MYUSERNAME");
  props.put("password", "MYPASSWORD");
  //
  // Put connection timeout in the property object
  //
  props.put("solid_connection_timeout_ms", "10000");
  try {
    // create driver
    Driver d = (Driver)(
      Class.forName("solid.jdbc.SolidDriver").newInstance());
    // get connection with url and property info
    Connection c = DriverManager.getConnection(       "jdbc:solid://localhost:1313", props );
    // close connection c.close();
   } catch ( Exception e ) {
      ; // save the day
    }
  }
}
Appinfo property
The connection attribute called Appinfo can be used to uniquely identify applications running in the same computer and under the same username, for the purposes of tracing and management. It can be retrieved, on the server side, with the command ADMIN COMMAND 'userlist'. By default, the value (a string) is not set. It is possible to set the value with the connection property “solid_appinfo”.
In ODBC applications, the value of Appinfo is passed by way of the environmental variable SOLAPPINFO.
Transparent connectivity (TC) properties
Transparent connectivity (TC) is a connection mode that can be used with the solidDB® HA solution (HotStandby). In JDBC, the TC mode is enacted with the following connection properties:
“solid_tf_level”
Sets the transparent failover level to “CONNECTION” or “SESSION”, or “NONE. The default is “NONE”.
“solid_preferred_access”
Sets the preferred access mode to “WRITE_MOSTLY” or “READ_MOSTLY”. The default value, “READ_MOSTLY”, enacts automatic load balancing of read-only transactions between the Primary and Secondary servers. The value “WRITE_MOSTLY” corresponds to a normal HotStandby operation whereby all the load is transferred to the Primary server.
“solid_tf1_reconnect_timeout”
Sets the timeout for how long the driver should wait until it tries to reconnect to the primary in case of TF switchover or failover. The unit is millisecond. The default is 10000 (10 seconds).
“solid_tf_wait_timeout”
Sets the timeout for how long the driver should wait for the server to switch state. The unit is millisecond. The default is 10000 (10 seconds).
For more information about using the TC connection properties, see “Using the Transparent Connectivity” in the solidDB® High Availability User Guide.
Socket linger connection properties
solid_socket_linger
Controls the TCP socket linger behavior after a close on the socket connection is issued. Possible values are 1 (default) and 0.
1 means that the system attempts to deliver any buffered data when a java.net.Socket.close() method on the socket connection is invoked.
0 means that the system discards any buffered data when a
java.net.Socket.close() method on the socket connection is invoked.
The solid_socket_linger connection property does not have any effect on the server-side setting defined with the Com.SocketLinger parameter.
solid_socket_linger_time
Defines the length of the time interval (in seconds) the socket lingers after a close is issued. If the time interval expires before the graceful shutdown sequence completes, an abortive shutdown sequence occurs (the data is discarded).
The default value is 10 (seconds).
The solid_socket_linger_time connection property does not have any effect on the server-side setting defined with the Com.SocketLingerTime parameter.
Shared memory access (SMA) connection property
A local (non RPC-based) JDBC connection to a SMA server can be made by setting the following connection property to “yes”. In addition, you also need to define that you are using a local server at a given port.
“solid_shared_memory”
The only valid value is “yes”.
For example:
Properties props = new Properties();
// enable the direct access property
props.put("solid_shared_memory", "yes");
// get connection
Connection c = DriverManager.getConnection
("jdbc:solid://localhost:1315", props);
For more details, see Making JDBC connections for SMA in the solidDB® Shared Memory Access and Linked Library Access User Guide.
Catalog and schema name properties
The catalog name and schema name can be set with the following connection properties:
“solid_catalog”
Sets the catalog name.
“solid_schema”
Sets the schema name.
Encryption properties
“solid_use_encryption”
Controls the use of encryption of passwords and database files using DES algorithm. Possible values are “yes” and “no”.
“solid_use_strong_encryption”
Setting connection properties with the URL string
Any connection property can be also set, at connect time, within JDBC URL passed to the JDBC method DriverManager.getConnection(). In this case, the syntax of the JDBC URL is the following:
"jdbc:solid://<hostname>:<port>/>username>/<password>[?<property-name>=<value>]..."
Examples
"jdbc:solid://locahost:1964/dba/dba"
"jdbc:solid://server1.acme.com:1964/dba/dba?solid_login_timeout_ms=100"
"jdbc:solid://server1.acme.com:1964/dba/dba?solid_login_timeout_ms=100?solid_idle_timeout_min=5"
See also
solidDB® JDBC Driver extensions