EasyManuals Logo

IBM DB2 User Manual

IBM DB2
585 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #102 background imageLoading...
Page #102 background image
a. Specify the server name and port number of the primary server that you
want to use in the connection URL.
b. Set the clientRerouteAlternateServerName and
clientRerouteAlternatePortNumber properties to the server name and port
number of the alternate server that you want to use.
v If your application is using the DataSource interface for connections, use one
of the following techniques:
– Set the server names and port numbers in DataSource properties:
a. Set the serverName and portNumber properties to the server name
and port number of the primary server that you want to use.
b. Set the clientRerouteAlternateServerName and
clientRerouteAlternatePortNumber properties to the server name and
port number of the alternate server that you want to use.
– Configure JNDI for client reroute by using a DB2ClientRerouteServerList
instance to identify the primary server and alternate server.
a. Create an instance of DB2ClientRerouteServerList.
b. Set the
com.ibm.db2.jcc.DB2ClientRerouteServerList.primaryServerName and
com.ibm.db2.jcc.DB2ClientRerouteServerList.primaryPortNumber
properties to the server name and port number of the primary server
that you want to use.
c. Set the
com.ibm.db2.jcc.DB2ClientRerouteServerList.alternateServerName
and
com.ibm.db2.jcc.DB2ClientRerouteServerList.alternatePortNumber
properties to the server name and port number of the alternate server
that you want to use.
d. To make the DB2ClientRerouteServerList persistent:
1) Bind the DB2ClientRerouteServerList instance to the JNDI registry.
2) Assign the JNDI name of the DB2ClientRerouteServerList object to
the IBM Data Server Driver for JDBC and SQLJ
clientRerouteServerListJNDIName property.
2. Connect to the data source that represents the primary server.
Examples
Suppose that your installation has a primary server and an alternate server with
the following server names and port numbers:
Server name Port number
mvs1.sj.ibm.com 50000
mvs3.sj.ibm.com 50002
The following code sets up DataSource properties in an application so that the
application connects to mvs1.sj.ibm.com as the primary server, and
mvs3.sj.ibm.com as the alternative server. That is, if mvs1.sj.ibm.com is down
during the initial connection, the driver should connect to mvs3.sj.ibm.com.
ds.setDriverType(4);
ds.setServerName("mvs1.sj.ibm.com");
ds.setPortNumber("50000");
ds.setClientRerouteAlternateServerName("mvs3.sj.ibm.com");
ds.setClientRerouteAlternatePortNumber("50002");
86 Application Programming Guide and Reference for Java
â„¢
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
||
||
|
|
|
|
|
|
|
|
|
|

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM DB2 and is the answer not in the manual?

IBM DB2 Specifications

General IconGeneral
DeveloperIBM
Initial Release1983
LicenseProprietary
Written inC, C++
CategoryDatabase Management System (RDBMS)
Operating SystemLinux, Windows
Programming LanguagesC, C++
Data ModelsRelational
EditionsCommunity, Standard, Advanced
Key Featureshigh availability, scalability