CONNX Data Integration Suite 14.8.0 | Developer Guide | CONNX JDBC Driver | Connecting to a JDBC Data Source
 
Connecting to a JDBC Data Source
Before beginning any of the below procedures, you must have a JDK (Java Development Kit) that is compatible with your system installed.
1. Use the DSNRegistry tool to create a logical name, known as a Data Source Name (DSN) that points to the CDD.
The CDD DSN should be registered on the same machine on which the CONNX JDBC Server is installed. The CONNX JDBC Server checks the Windows registry on that machine to locate the DSNs.
A JDBC DSN is not the same as an ODBC DSN. If you intend to use both ODBC and JDBC to access databases, you must create a DSN for both access methods.
2. You can add a new data source name for the JDBC Driver:
a. In the DSNRegistry, click Add.
The CDD Data Source Setup dialog box appears. The Samples CDD DSN for ODBC is created automatically when the CONNX JDBC component is installed.
b. Enter the required information in the respective fields.
The Custom button for the Application field becomes active when the Connect to selected databases is selected from the Application combo box. When you press the Custom button, a list of the databases in the CDD appears, allowing you to select one or all of the databases for connection.
c. Click OK to return to the Data Source Name Registry dialog box.
d. Exit the dialog box.
3. Set the ClassPath.
Java Virtual Machines rely on an environment variable called Classpath to point to the necessary Java components (classes) required for execution. When the CONNX JDBC Driver is used, the Classpath environment variable must be extended to enable the CONNX JDBC Driver (Thin Client). The CONNX JDBC Driver is referred to by its file name: C:\CONNX32\CONNXJDBC\java\jar\connxjdbc.jar
To set the system environment variables:
a. Enter the new Variable Name (Classpath), and the Variable Value (C:\CONNX32\CONNXJDBC\java\jar\connxjdbc.jar).
b. Click OK.
4. Load and register the CONNX JDBC Driver. To do so, enter the following JDBC call within the Java program:
Class.forName("com.Connx.jdbc.
TCJdbc.TCJdbcDriver").newInstance();
Note: 
The variable newInstance is inserted to ensure that the Class is registered. Some browsers have had difficulty loading Class without newInstance included as part of the syntax.
5. Open a connection to the CONNX JDBC Driver (Thin Client).
The JDBC method getConnection(xxx) is used to make a connection to the JDBC data source. Several different getConnection() methods exist in JDBC. The URL remains constant in both of the methods, as this is where the driver- specific information is placed. The URL is concatenated with the following attributes:
Attribute
Description
Driver Identifier
For CONNX JDBC, the format is as follows: jdbc:connx:
Database Identifier
For CONNX JDBC, this represents the symbolic name for the CDD registered via the DSNRegistry tool. The format is as follows: DD=Symbolic Name for Data Source
TCP/IP Address of Server
This is the TCP/IP address or host name of the server (or the CONNX Router if a CONNX Router is required by your configuration). The format is as follows: GATEWAY=TCPIP address or hostname of Server/Router
PORT (optional argument)
The CONNX JDBC server is bound to a specific port. The default is 7500, but the server can be invoked with a different port. The client and server must be in sync; if the server has a different port number, then the URL must represent this by including the PORT option. The format is as follows : PORT=7510
SSL (optional argument)
If the JDBC server is configured for SSL connections, then the java client must specify "ssl=true" in the connection string. The format is as follows: SSL=true
ADADBIDLIST (optional argument)
Allows dynamic rebinding of adabas DBIDs in the CONNX data dictionary. This is useful if you have multiple Adabas databases with identical structures, but different data. At connection time, you can redirect one or more databases in the CDD to different adabas DBIDs. It is the responsibility of the user to ensure that the structure is the same between the database, otherwise error will occur during query processing.
ADADBIDLIST=(logicalCDDDatabaseName:
new DBID,logicalCDDDatabaseName:
new DBID,…)
In addition, multiple JDBC Servers and/or Data servers are supported on the CDD server name fields and the JDBC connection string.
servername[:port][!servername[:port]][!servername[:port]]...
When a list of servers is provided, CONNX initially picks one at random. If the connection fails for that server, it will then serially loop through all the servers from that point forward, wrapping back around to the beginning if necessary, until all options are exhausted or a successful connection is established.
Type the above criteria on the command line in your system or within the Java program code.