8.4.OpenLink JDBC Driver (Single-Tier Edition) for JDBC Utilization

OpenLink Drivers for JDBC are available in three different JDBC Driver formats.

  • JDBC Type 1. Driver for JDBC is implemented as a bridge to ODBC Drivers, thereby implementing the JDBC Driver classes through native methods, this is due to the fact that ODBC is a 'C' language based data access application programming interface. Thus, this driver format is inherently part Java and part Native, implying that it is inherently platform specific rather than independent.

  • JDBC Type 2. Driver for JDBC is implemented as a bridge to Native Database Call Level Interfaces, thereby implementing the JDBC Driver classes through native methods, this is due to the fact that Native Database Call Interfaces are either C/C++ language based data access application programming interfaces. Thus, this driver format is inherently part Java and part Native, implying that it is inherently platform specific rather than independent

[Note] Note:

JDBC Lite can be JDBC Types 1 or 2 only because you have to address platform specific database vender software beneath.

JDBC Applets, Applications, Bean Components, and Servlets communicate with JDBC drivers through JDBC Uniform Resource Locators (URLs). Theses URLs are service request and binding formats implemented slightly differently for each OpenLink Driver for JDBC format. The general JDBC URL format is:

jdbc:<jdbc-subprotocol>:[jdbc implementation specific URL attributes]

The "sub-protocol" component of the URL above identifies each JDBC implementation and typically identifies the JDBC driver vendor, the actual URL attributes are vendor specific. Each OpenLink Driver for JDBC type has a different JDBC URL format, the sections that follow depict and provides examples of these formats.

8.4.1.OpenLink Driver for JDBC Type 1

URL Format variation 1

This driver format connects you to ODBC Data Source Names (DSNs) via JDBC. The URL format is as follows:

jdbc:openlink://ODBC[/DSN][/UID][/PWD][/READONLY]

URL Attributes

/DSN - ODBC Data Source Name

/UID - Username

/PWD - Password

/READONLY - Determines session mode, read-write or read-only.

Example:

If you were attempting to connect to an ODBC DSN on your machine named "Customers Database" in read-only mode then you would enter the following JDBC URL:

jdbc:openlink://ODBC/DSN=CustomerDatabase/UID=test/PWD=test/READONLY=Y

[Note] Note:

In the case of OpenLink ODBC DSNs you do not have to provide values for the /UID and /PWD attributes since these can be controlled and configured on the database or application server using the OpenLink Session Rules Book.

URL Format variation 2

This is an alternative connect string format, that is compatable with the Sun JDBC to ODBC Type 1 bridge:

jdbc:odbc:<dsn>;UID=<uid>;PWD=<pwd>

URL Attributes

<dsn> - ODBC Data Source Name

<uid> - Username

<pwd> - Password

8.4.2.OpenLink Driver for JDBC Type 2

URL Format

This driver format connects you to UDBC Data Source Names (DSNs) via JDBC. The URL format is as follows:

jdbc:openlink://UDBC[/DSN][/UID][/PWD][/READONLY]

URL Attributes

/DSN - ODBC Data Source Name

/UID - Username

/PWD - Password

/READONLY - Determines session mode, read-write or read-only.

Example:

If you were attempting to connect to an UDBC DSN on your machine named "Customers Database" in read-only mode then you would enter the following JDBC URL:

jdbc:openlink://UDBC/DSN=CustomerDatabase/UID=test/PWD=test/READONLY=Y

[Note] Note:

In the case of OpenLink ODBC DSNs you do not have to provide values for the /UID and /PWD attributes since these can be controlled and configured on the database or application server using the OpenLink Session Rules Book.

8.4.3.OpenLink Driver for JDBC Type 3

URL Format

This driver format connects you to remote database directly via the OpenLink Database drivers. The URL format is as follows:

        jdbc:openlink://<Hostname>:[portnumber] [/DSN] [/UID] [/PWD] [/READONLY] [/FBS]
                        [/JDBCAGENT] [/SVT] [/DATABASE] [/OPTIONS] [/DRIVER]

URL Attributes

Hostname - Network Alias or IP address of server machine running an OpenLink Request Broker instance

Port Number - Port number that identifies location of OpenLink JDBC Agent Service, the default value is 5000

/DSN - ODBC Data Source Name

/UID - Username

/PWD - Password

/READONLY - Determines session mode, read-write or read-only

/FBS - Sets number of JDBC resultset rows that get packed into a single network packet

/JDBCAGENT - Determines JDBC Agent type used rather than default (JDBC Agents exist for ODBC and UDBC)

/SVT - Determines OpenLink Database Agent type (Oracle, Informix, Sybase, Progress, Ingres, SQL Sever, Sybase etc.)

/DATABASE - Actual database name within a particular database environment

/OPTIONS - Values used to connect to OpenLink Database Agents to remote database servers using database vendors networking

/DRIVER - Used when making a DSN-Less connection to a remote ODBC Driver

8.4.4.Examples

Connecting To Remote Database

If you were attempting to connect to a remote Database Server Type "SQLServer 2000", hosted on a database server machine with the network alias "pluto", with an OpenLink JDBC server listening at port 5001 (rather than default of 5000), and you wanted this session to be in read-only mode then you would enter the following JDBC URL:

jdbc:openlink://pluto:5001/SVT=SQLServer 2000/UID=test/PWD=test/
                READONLY=YES/FBS=55
[Note] Note:
  1. In the case of OpenLink ODBC DSNs you do not have to provide values for the /UID and /PWD attributes since these can be controlled and configured on the database or application server using the OpenLink Session Rules Book

  2. "/FBS" ensures that each iteration of a JDBC Resultset fetch loop returns 55 records or less until all records have been retrieved from a remote database server

Connecting To Remote UDBC DSN

If you were attempting to connect to a remote UDBC DSN named "Customers Database", hosted on a database server machine with the network alias "pluto", with an OpenLink JDBC server listening at port 5001 (rather than default of 5000), and you wanted this session to be in read-only mode then you would enter the following JDBC URL:

jdbc:openlink://pluto:5001/DSN=CustomerDatabase/UID=test/PWD=test/
                READONLY=Y/JDBCAGENT=judbc/FBS=55
[Note] Note:
  1. In the case of OpenLink ODBC DSNs you do not have to provide values for the /UID and /PWD attributes since these can be controlled and configured on the database or application server using the OpenLink Session Rules Book

  2. If "pluto" is a Linux or UNIX machine then the "/JDBCAGENT" attribute defaults to "judbc" when left out of the JDBC URL. Likewise if "pluto" is a Windows 95/98/NT/2000 machine the "/JDBCAGENT" attribute defaults to "jodbc"

  3. "/FBS" ensures that each iteration of a JDBC Resultset fetch loop returns 55 records or less until all records have been retrieved from a remote database server

Connecting To Databases Using DSN-Less Connections

You do not have to create ODBC or UDBC DSNs in order to use your OpenLink Drivers for JDBC when using the type 3 format. Instead you can specify the OpenLink Database Type and Database Name attributes as part of your JDBC URL.

To connect to a remote Microsoft SQL Server database without going via an ODBC DSN you would construct the following URL:

jdbc:openlink://saturn:5001/SVT=SQLServer6/DATABASE=pubs/UID=sa/
                PWD=/FBS=55/READONLY=Y
[Note] Notes:
  1. In the case of OpenLink ODBC DSNs you do not have to provide values for the /UID and /PWD attributes since these can be controlled and configured on the database or application server using the OpenLink Session Rules Book

  2. As "saturn" is a Windows 95/98/NT/2000 machine the "/JDBCAGENT" attribute defaults to "jodbc"

  3. This feature applies to both OpenLink JDBC Agent types: JODBC Agent and JUDBC Agent

Connecting To Database via ODBC Driver Without A DSN (DSN-Less Connection)

This JDBC URL format is currently only supported by the OpenLink JDBC Agent for ODBC DSNs (JODBC Agent). DSN-Less connections require you to determine the ODBC connect string attributes for the ODBC Driver that you are using. For OpenLink ODBC Drivers these values are:

Table8.2.Connect String Attributes

Attribute Description
ServerType Database Type
Host Machine hosting the Database Agent serving an OpenLink ODBC Driver
Username Valid Database Username
Password Valid Password for Username
FetchBufferSize Number of resultset records fetched during each ODBC fetch loop
Database Actual database name within database server environment
NoLoginBox Disables OpenLink ODBC Drivers attempt to present dialog when ODBC Driver determines an incomplete ODBC connect string (collection of ODBC attributes passed at connect time) good examples being missing or blank "Username" and "Password" attributes.

If you were connecting a remote Oracle database on a machine called "pluto" and you wanted this session to be read-only, your URL formal would be as follows:

jdbc:openlink://pluto/DRIVER={OpenLink Generic 32 Bit Driver}/Database=ORCL/Username=test/
                        PWD=test/ReadOnly=Yes/FBS=55/ServerType=Oracle 8/Host=pluto

Connecting To Remote Databases On Separate Server Machine (OpenLink 3-Tier Architecture)

You may choose to install your OpenLink Drivers for JDBC on an Application Server and then install your OpenLink Data Access Server components (Request Broker and Database Agents) on your dedicated database server machine. In such a scenario you will be connecting to your remote database engine using OpenLink Database Independent as opposed to your Database vendor's database specific networking middleware.

If you were connecting from your Application Server called "pluto" to a dedicated Database Server machine named "ora_server", hosting an Oracle database identified as "ORCL" you would construct the following JDBC URL:

jdbc:openlink://pluto/SVT=Oracle 6/UID=test/PWD=test/HOST=ora_server

[Note] Notes:
  1. This feature applies to both OpenLink JDBC Agent types: JODBC Agent and JUDBC Agent

  2. You could also have used the "/DSN" attribute to point to an ODBC or UDBC DSN which has been configured to connect to the Database Server machine, this simply reduces the size of your JDBC URL, but imposes the use of DSNs upon you.

Connecting To Remote Databases On Separate Server Machine Using Database Vendors Networking (Mixed 3-Tier Architecture)

Organizational standards or individual preference may present you with a scenario in which you have two server machines in use, one acting as an Application Server hosting your OpenLink Drivers for JDBC and OpenLink Data Access Server components (Request Broker & Database Agents), and the other acting as a dedicated Database Server. You may not have the necessary authority to install the OpenLink Data Access Server components on the Database Server, or you simply prefer to use your database vendors networking software which is already configured on your Application Server. This scenario can be described as a "Mixed 3-Tier" architecture, this is because you are going to use your OpenLink Database Agents atop database vendor provided networking rather than connecting to an OpenLink Database Agent using OpenLink Database independent networking.

If you were connecting to a remote Oracle database somewhere on your network from our application server called "pluto" using an ODBC DSN called "Customers" you would construct the following JDBC URL assuming a Net8 or SQL*Net "tnsname" or server alias called "ora_pluto":

jdbc:openlink://pluto/SVT=Oracle 8/UID=test/PWD=test/OPTIONS=ora_pluto
[Note] Notes:
  1. The "/OPTIONS" JDBC URL attribute provides the entry or bind point for connecting OpenLink Database agents to Database vendors networking products. This applies to all supported OpenLink databases, see the OpenLink Database Agents configuration guide for additional information relating to the database specific formats of values passed to the "/OPTIONS" JDBC URL attribute

  2. This feature applies to both OpenLink JDBC Agent types: JODBC Agent and JUDBC Agent

  3. You could also have used the "/DSN" attribute to point to an ODBC or UDBC DSN which has been configured to connect to the Database Server machine, this simply reduces the size of your JDBC URL, but imposes the use of DSNs upon you.