Previous |
Next |
JDBC Connection Failure Notification enables stand-alone Oracle JDBC connections to respond to node failures quicker. This feature enables a stand-alone connection to listen for Oracle RAC node down events and respond to a node down event by marking the connection closed, permitting user applications to begin recovery quicker. It does not alter the behavior of the application, except that JDBC method calls will throw exceptions more quickly after a node goes down.
To configure Connection Failure Notification, you use the ConnectionFailureNotification connection property.
To configure JDBC clients for Connection Failure Notification:
Set the Connection Failure Notification property either as a system property using the -D option, or by including it in the connection properties argument when creating a connection.
To set it as a system property, use a command similar to the following:
java -Doracle.jdbc.ConnectionFailureNotification=true
To set it within the connection properties argument, use code similar to the following:
Properties props = new Properties(); props.put("ConnectionFailureNotification", "true"); Connection = DriverManager.getConnection(url, props);
Configure the transport mechanism by which the node down events are received. If ONS is the selected transport mechanism, then use the SetONSConfiguration property, as demonstrated in the following code, where docrac1
and docrac2
represent nodes in the cluster that have ONS running on them:
props.setONSConfiguration(“nodes=docrac1:4200,docrac2:4200”);
Make sure that ons.jar
is in the application CLASSPATH.