Implement failover support in SAP jConnect.
The primary server entry has an attribute (the HA OID) that refers to the entry for the secondary server.
Relative distinguished name (RDN) – assumes that the search base (typically provided by the java.naming.provider.url attribute), combined with the value of this attribute, is enough to identify the secondary server.
dn: servername=haprimary, o=Sybase, c=US 1.3.6.1.4.1.897.4.2.5: TCP#1#hostname 4200 1.3.6.1.4.1.897.4.2.15: servername=hasecondary objectclass: sybaseServer
dn: servername=hasecondary, o=Sybase, c=US 1.3.6.1.4.1.897.4.2.5: TCP#1#hostname 4202 objectclass: sybaseServer
Distinguished name (DN) – assumes that the value of the HA attribute uniquely identifies the secondary server, and may or may not duplicate values found in the search base.
dn: servername=haprimary, o=Sybase, c=US 1.3.6.1.4.1.897.4.2.5: TCP#1#hostname 4200 1.3.6.1.4.1.897.4.2.15: servername=hasecondary, o=Sybase, c=US ou=Accounting objectclass: sybaseServer
dn: servername=hasecondary, o=Sybase, c=US, ou=Accounting 1.3.6.1.4.1.897.4.2.5: TCP#1#hostname 4202 objectclass: sybaseServer
Notice that hasecondary is located in a different branch of the tree (see the additional ou=Accounting qualifier).
Full LDAP URL – assumes nothing about the search base. The HA attribute is expected to be a fully qualified LDAP URL that is used to identify the secondary (it may even point to a different LDAP server).
dn: servername=hafailover, o=Sybase, c=US 1.3.6.1.4.1.897.4.2.5: TCP#1#hostname 4200 1.3.6.1.4.1.897.4.2.15: ldap://ldapserver: 386/servername=secondary, o=Sybase, c=US ou=Accounting objectclass: sybaseServer
dn: servername=secondary, o=Sybase, c=US, ou=Accounting 1.3.6.1.4.1.897.4.2.5: TCP#1#hostname 4202 objectclass: sybaseServer
Use the REQUEST_HA_SESSION connection property to indicate that the connecting client wants to begin a failover session with Adaptive Server that is configured for failover. Setting this property to true instructs SAP jConnect to attempt a failover login. If you do not set this connection property, a failover session doses not start, even if the server is configured correctly. The default value for REQUEST_HA_SESSION is false.
Set the connection property like any other connection property. You cannot reset the property once a connection has been made.
If you want more flexibility for requesting failover sessions, code the client application to set REQUEST_HA_SESSION at runtime.
dn: servername=SYBASE11,o=MyCompany,c=US 1.3.6.1.4.1.897.4.2.5:TCP#1#tahiti 3456 1.3.6.1.4.1.897.4.2.10:REPEAT_READ=false&PACKETSIZE=1024 1.3.6.1.4.1.897.4.2.10:CONNECTION_FAILOVER=false 1.3.6.1.4.1.897.4.2.11:pubs2 1.3.6.1.4.1.897.4.2.9:Tds 1.3.6.1.4.1.897.4.2.15:servername=SECONDARY 1.3.6.1.4.1.897.4.2.10:REQUEST_HA_SESSION=true
dn:servername=SECONDARY, o=MyCompany, c=US 1.3.6.1.4.1.897.4.2.5:TCP#1#moorea 6000
/* get the connection */ Connection con = DriverManager.getConnection ("jdbc:sybase:jndi:ldap://ldap_server1:389" + "/servername=Sybase11,o=MyCompany,c=US",props);, or
props.put(Context.PROVIDER_URL, "ldap://ldap_server1:389/ o=MyCompany, c=US");
Connection con=DriverManager.getConnection ("jdbc:sybase:jndi:servername=Sybase11", props);
'The server denied your request to use the high- availability feature. Please reconfigure your database, or do not request a high-availability session.'
‘SAP Adaptive Server Enterprise high-availability failover has occurred. The current transaction is aborted, but the connection is still usable. Retry your transaction.’
The client automatically reconnects to the secondary database using JNDI and lets you:
After failback, the client can expect the same behavior and results on the primary server during failover to the secondary server.