Difference between revisions of "Connecting to DB2"

From PresenceWiki
Jump to: navigation, search
 
Line 27: Line 27:
 
DB2 uses system accounts, so the username may need to be fully qualified with the domain, e.g mydomain\user.
 
DB2 uses system accounts, so the username may need to be fully qualified with the domain, e.g mydomain\user.
  
http://www.international-presence.com/wikidocs/images/db2_connection.png
+
[[file:db2_connection.png]]
  
 
=== Pooling Options ===
 
=== Pooling Options ===
Line 37: Line 37:
 
To avoid this error, we recommend using a custom validation query. Select the second tab of the resource editor (see image below) and check "Use custom query to validate connections". Enter a custom query in the field below, for example:
 
To avoid this error, we recommend using a custom validation query. Select the second tab of the resource editor (see image below) and check "Use custom query to validate connections". Enter a custom query in the field below, for example:
  
http://www.international-presence.com/wikidocs/images/db2_custom_query.png
+
[[file:db2_custom_query.png]]
  
 
More information on this can be found under [[Database_Resource#Connection_Pooling|Connection Pooling]].
 
More information on this can be found under [[Database_Resource#Connection_Pooling|Connection Pooling]].

Latest revision as of 12:34, 21 August 2015

Database Connectivity > Connecting to DB2

These instructions are for connecting to IBM DB2 server.

Prerequisites

You must have access to the DB2 JDBC driver, which is bundled in a file called db2jcc.jar. You can locate this under your DB2 installation, typically located at:

[INSTALL_ROOT]\IBM\SQLLIB\java

This file must be imported into the Presence Jar Manager.

Connection Parameters

The Driver class should be as follows:

com.ibm.db2.jcc.DB2Driver

And the following connection URL should be used:

jdbc:db2://<hostname>[<:port>]/[DATABASE_NAME]

Typically the port will be 50000 on Windows systems.

Username and Password

DB2 uses system accounts, so the username may need to be fully qualified with the domain, e.g mydomain\user.

Db2 connection.png

Pooling Options

Please note that like SQL Server, when the DB2 instance is stopped and restarted any existing connections to the database remain active, even though they are no longer usable. After restarting the database the following error will be reported by Presence:

Statement failed - [jcc][t4][2030][11211][3.50.152] A communication error occurred during operations on the connection's underlying socket, socket input stream, or socket output stream. Error location: Reply.fill(). Message: Software caused connection abort: recv failed. ERRORCODE=-4499, SQLSTATE=08001

To avoid this error, we recommend using a custom validation query. Select the second tab of the resource editor (see image below) and check "Use custom query to validate connections". Enter a custom query in the field below, for example:

Db2 custom query.png

More information on this can be found under Connection Pooling.


Database Connectivity > Connecting to DB2