Accessing JDBC datasource as400


Data source minimum required settings for DB2 Universal Database™ for IBM i

These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2® UDB data source.
What type of configuration do you have?

* DB2 UDB for iSeries with the application server for AIX, HP-UX, IBM i, Linux, Solaris, or Windows

DB2 UDB for iSeries with the application server for AIX, HP-UX, IBM i, Linux, Solaris, or Windows
You can configure the following types of providers:

* DB2 UDB for iSeries (Native)
* DB2 UDB for iSeries (Native XA)
* DB2 UDB for iSeries (Toolbox)
* DB2 UDB for iSeries (Toolbox XA)

* DB2 UDB for iSeries (Native)

The iSeries Developer Kit for Java™ contains this Type 2 JDBC driver that is built on top of the iSeries DB2 Call Level Interface (CLI) native libraries.
This provider:
o Is for local DB2 connections on iSeries. It is not recommended for remote access.
o Supports the one-phase data source:

com.ibm.db2.jdbc.app.UDBConnectionPoolDataSource

o Requires the following JDBC driver files:
+ db2_classes16.jar – for nodes that are running at Version 7.0 or later. The location of the jar file is /QIBM/Proddata/java400/jdk6/lib/ext/db2_classes16.jar.
+ db2_classes.jar – for nodes that are running at Version 6.1 or earlier. The location of the jar file is /QIBM/ProdData/Java400/ext/db2_classes.jar.
o Requires the following DataStoreHelper class:

com.ibm.websphere.rsadapter.DB2AS400DataStoreHelper

o Does not require an authentication alias.
o Requires the following properties:
+ databaseName – The name of the relational database to which the data source connections are established. This name must appear in the iSeries Relational Database Directory. The default is *LOCAL.
* DB2 UDB for iSeries (Native XA)

The iSeries Developer Kit for Java contains this XA-compliant Type 2 JDBC driver built on top of the iSeries DB2 Call Level Interface (CLI) native libraries.
This provider:
o Is for local DB2 connections on iSeries. It is not recommended for remote access.
o Supports the following two-phase data source:

com.ibm.db2.jdbc.app.UDBXADataSource

o Requires the following JDBC driver files:
+ db2_classes16.jar – for nodes that are running at Version 7.0 or later. The location of the jar file is /QIBM/Proddata/java400/jdk6/lib/ext/db2_classes16.jar.
+ db2_classes.jar – for nodes that are running at Version 6.1 or earlier. The location of the jar file is /QIBM/ProdData/Java400/ext/db2_classes.jar.
o Requires the following DataStoreHelper class:

com.ibm.websphere.rsadapter.DB2AS400DataStoreHelper

o Does not require an authentication alias.
o Requires the following properties:
+ databaseName – The name of the relational database to which the data source connections are established. This name must appear in the iSeries Relational Database Directory. The default is *LOCAL.
* DB2 UDB for iSeries (Toolbox)

This JDBC driver, also known as iSeries Toolbox driver for Java, is provided in the DB2 for iSeries database server.
This provider:
o Is for remote DB2 connections on iSeries. Use this driver instead of the IBM® Developer Kit for Java JDBC Driver to access remote DB2 UDB for iSeries systems.
o Supports the following one-phase data source:

com.ibm.as400.access.AS400JDBCConnectionPoolDataSource

o Requires the following JDBC driver files:
+ jt400.jar
o Requires the following DataStoreHelper class:

com.ibm.websphere.rsadapter.DB2AS400DataStoreHelper

o Does not require an authentication alias if the application server and DB2 UDB for iSeries are installed in the same server. If they are installed in different servers, the user ID and password are required.
o Requires the following properties:
+ serverName – The name of the server from which the data source obtains connections. Example: myserver.mydomain.com.
* DB2 UDB for iSeries (Toolbox XA)

This XA compliant JDBC driver, also known as iSeries Toolbox XA compliant driver for Java, is provided in the DB2 for iSeries database server.
This provider:
o Is for remote DB2 connections on iSeries. Use this driver instead of the IBM Developer Kit for Java JDBC Driver to access remote DB2 UDB for iSeries systems.
o Supports the following two-phase data source:

com.ibm.as400.access.AS400JDBCXADataSource

o Requires the following JDBC driver files:
+ jt400.jar
o Requires the following DataStoreHelper class:

com.ibm.websphere.rsadapter.DB2AS400DataStoreHelper

o Does not require an authentication alias if the application server and DB2 UDB for iSeries are installed in the same server. If they are installed in different servers, the user ID and password are required.
o Requires the following properties:
+ serverName – The name of the server from which the data source obtains connections. Example: myserver.mydomain.com.

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rdat_minrequdb.html

Datasouce Access
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(“java:comp/env/jdbc/myDataSource”);

FAQ
http://www-03.ibm.com/systems/i/software/toolbox/faqjdbc.html

Advertisements