With JDBC, Transparent Connectivity (TC) is enabled by using non-standard connection properties. The list of server addresses is given as a part of the JDBC connect string.
Note When using transparent connectivity in JDBC, you must drop statement objects explicitly. The garbage collector does not detect unreferenced statement objects.
Failure transparency level (solid_tf_level)
The solid_tf_level connection property is used to enable failure transparency. The value is a string that you can specify as a mnemonic (for example, NONE) or as a number (0 for NONE). For clarity, use of mnemonics is preferable.
Three levels are available:
1 NONE | 0 – failure transparency is disabled (default).
2 CONNECTION | 1 – the server connection is preserved.
3 SESSION | 3 – certain session attributes that have non-default values are preserved.
If the solid_tf_level connection property is not specified (or the property is set to NONE), the connection behavior falls back to Basic Connectivity.
The solid_preferred_access property indicates whether the load balancing of read-only loads is applied or not. The value is a string; you can specify it as a mnemonic or as a number. For clarity, use of mnemonics is preferable.
The following levels are available:
▪ WRITE_MOSTLY | 0 – the read workload is directed to the primary server (default). All transactions are executed on the primary server.
▪ READ_MOSTLY | 1 – the read workload is shared between the primary and secondary servers as defined by the Cluster.ReadMostlyLoadPercentAtPrimary parameter, see Cluster section. The write transactions are directed to the primary server.
If the solid_preferred_access connection property is not specified, the connection behavior falls back to Basic Connectivity.
The solid_tf1_reconnect_timeout property specifies the connection reconnect timeout in milliseconds. The default value is 10000 milliseconds (10 seconds).
Server addresses
The list of server addresses is given as a part of the extended JDBC connect string:
The number of addresses in the address list is limited to 20.
Note If your setup uses multi-home servers to deploy different networks for the connections between the application and the servers and the servers themselves, see Configuring server addresses with multi-home servers.
SMA connection (solid_shared_memory)
With SMA configurations, the non-standard property solid_shared_memory must be set to yes. You must also define that you are using a local server on a given port.
Examples
TC connection with failure transparency level of CONNECTION
... String conStr = "jdbc:solid://srv1.acme.com:1323,srv2-acme.com:1423/dba/dba"; Properties prop = new Properties(); prop.setProperty("solid_tf_level", "CONNECTION"); ... Connection c = DriverManager.getConnection(conStr, prop); ...
TC connection with SMA
... String conStr = "jdbc:solid://localhost:1323,srv2-acme.com:1423/dba/ dba?solid_shared_memory=yes"; Properties prop = new Properties(); prop.setProperty("solid_tf_level", "CONNECTION"); Connection c = DriverManager.getConnection(conStr, prop); ...