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 #103 background imageLoading...
Page #103 background image
The following code configures JNDI for client reroute. It creates an instance of
DB2ClientRerouteServerList, binds that instance to the JNDI registry, and assigns
the JNDI name of the DB2ClientRerouteServerList object to the
clientRerouteServerListJNDIName property.
// Create a starting context for naming operations
InitialContext registry = new InitialContext();
// Create a DB2ClientRerouteServerList object
DB2ClientRerouteServerList address = new DB2ClientRerouteServerList();
// Set the port number and server name for the primary server
address.setPrimaryPortNumber(50000);
address.setPrimaryServerName("mvs1.sj.ibm.com");
// Set the port number and server name for the alternate server
int[] port = {50002};
String[] server = {"mvs3.sj.ibm.com"};
address.setAlternatePortNumber(port);
address.setAlternateServerName(server);
registry.rebind("serverList", address);
// Assign the JNDI name of the DB2ClientRerouteServerList object to the
// clientRerouteServerListJNDIName property
datasource.setClientRerouteServerListJNDIName("serverList");
Enabling IBM Data Server Driver for JDBC and SQLJ client
reroute for connections to IDS servers
To enable client reroute for IBM Data Server Driver for JDBC and SQLJ
applications that connect to IBM Informix Dynamic Server (IDS) servers, you need
to connect to a Connection Manager.
Before you can enable IBM Data Server Driver for JDBC and SQLJ client reroute
for connections to IBM Informix Dynamic Server, your installation must have one
or more Connection Managers, a primary server, and one or more alternate servers.
After the Connection Managers, primary server, and alternate servers are set up,
follow these steps:
1. Set the appropriate properties to specify the Connection Manager addresses.
v If your installation is using a single Connection manager for client reroute,
and your application is using the DataSource interface for connections, set
the serverName and portNumber properties to the server name and port
number of the Connection Manager.
v If your installation is using a single Connection manager for client reroute,
and your application is using the DriverManager interface for connections,
specify the server name and port number of the Connection manager in the
connection URL.
v If your installation is using more than one Connection manager for client
reroute, and your application is using the DriverManager interface for
connections:
a. Specify the server name and port number of the main Connection
manager that you want to use in the connection URL.
b. Set the clientRerouteAlternateServerName and
clientRerouteAlternatePortNumber properties to the server names and
port numbers of the alternative Connection Managers that you want to
use.
Chapter 3. JDBC application programming 87
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

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