Opening a connection to the CONNX JDBC Driver

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:

  • 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

 

The example below demonstrates a getConnection call for CONNX based on the following criteria:

  • Server named Sparky

  • JDBC Data Source called Payroll

    connectionObj = DriverManager.getConnection
    ("jdbc:connx:DD=Payroll;Gateway=Sparky",
    username, password);

     

Additionally - support for multiple JDBC Servers and/or Data servers has been added to the CDD server name fields and the JDBC connection string.

 

<servername>[:<port>][!<servername>[:<port>]][!<servername>[:<port>]]...

 

Note:  Each instance of <servername>[:<port>] is spearated by an exclaimation (!) mark.

 

For example - if you have two JDBC servers set up for redundancy - one on a server called PRIMARY, listening on port 7323

and another server called SECONDARY, listening on port 8754, the gateway server name would be:

 

PRIMARY:7323!SECONDARY:8754

 

When a list of servers is provided - CONNX will initially pick 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.

Related Topics

image\CHICLET.jpg To load and register the CONNX JDBC Driver