Requirements, dependencies, and restrictions  Performing server-to-server remote procedure calls

Chapter 2: Programming Information

Implementing failover in jConnect

To implement failover support in jConnect choose one of the following two methods:

  1. Use the two connection properties, REQUEST_HA_SESSION and SECONDARY_SERVER_HOSTPORT and set the following:

  2. Use JNDI to connect to the server (See “Connecting to a server using JNDI”). Include an entry for the primary server and a separate entry for the secondary server in the directory service information file required by JNDI. The primary server entry will have an attribute (the HA OID) that refers to the entry for the secondary server.

    Using LDAP as the service provider for JNDI, there are three possible forms that this HA attribute can have:

    If you want more flexibility for requesting failover sessions, code the client application to set REQUEST_HA_SESSION at runtime.The following example shows connection information entered for the database server SYBASE11 under an LDAP directory service:

    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
    

    where “tahiti” is the primary server and “moorea” is the secondary companion server.

  3. Request a connection using JNDI and LDAP.


Logging in to the primary server

If an Adaptive Server is not configured for failover, or for some reason cannot grant a failover session, the client cannot log in, and the following warning displays:

'The server denied your request to use the high-availability feature. Please reconfigure your database, or do not request a high-availability session.'

Failing over to the secondary server

When failover occurs, the SQL exception JZ0F2 is thrown:

‘Sybase high-availability failover has occurred. The current transaction is aborted, but the connection is still usable. Retry your transaction.’

The client then automatically reconnects to the secondary database using JNDI.

Note that:


Failing back to the primary server

At some point, the client will fail back from the secondary server to the primary server. When failback occurs is determined by the System Administrator who issues sp_failback on the secondary server. Afterward, the client can expect the same behavior and results on the primary server as documented in “Failing over to the secondary server”.





Copyright © 2003. Sybase Inc. All rights reserved. Performing server-to-server remote procedure calls

View this book as PDF