Attunity provides a full JDBC 2.0 driver. The user can use the ThinClient kit to work against any Attunity DataSource, from simple FLAT files on the PC, to VSAM CICS and IMS/DB DataSources on the Mainframe.

Attached a simple JDBC program which works with the NvDataSource class to connect to the Attunity Server.


Here's an explanation about some highlights in the sample code:

STEP 1 - Creating the NvDataSource

The first step before creating the NvDataSource is importing the Attunity DataSource class:-
import com.attunity.jdbc.NvDataSource;
Then you can create an instance of the DataSource as follows:-
NvDataSource ds = null;
ds = new NvDataSource();
STEP 2 - Setting up the DataSource

Here is a sample code which initializes the DataSource with the different connection properties:-

  • Connect to the Attunity Server Daemon located at IP -, and Port Number - 2551 (could be a Mainframe machine).
  • Set the Default DataSource to IMS DB DataSource (called IMSDB_DS). This DataSource should be located on the specified server.
STEP 3 - Connect to the Server

Get a connection from the DataSource:-
con = ds.getConnection();
See the attached sample for the full code.

  • The sample targets the daemon on the "localhost", this can be easily modified.
  • The JAVA CLASSPATH should contain a full reference to the NVJDBC2.JAR. When debugging your code using the "Log" properties, the CLASSPATH should also include the NVLOG2.JAR and the NVAPISPY2.JAR files.
  • For older JDK releases, you may need to include the J2EE.JAR file in your CLASSPATH. (Part of Sun's J2EE SDK)
Here is a sample output:-
T:\JDBC>java SimpleJDBC_DS
Connected to localhost:2551

Execute the Query...

Get Rows:

Col1 = 1, Col2 = John Friedman
Col1 = 2, Col2 = Jack Jones
Col1 = 3, Col2 = Ron Murphy
Col1 = 4, Col2 = Richard Smith
Col1 = 5, Col2 = Dan Hoffman
Col1 = 29, Col2 = Daniel Black
Col1 = 30, Col2 = Rick Stanley