When you need to connect to an IBM DB2 database this component will help you. There are two ways of getting a connection; a direct connection or through a pool. For more info about pools see the Connections Pool section of the help.
Using a direct connection means that you connect to the database server directly using an IP address and a port. This is the easiest way since there is no configuration needed and it only requires a few parameters. However for production code, we strongly recommend you to look at connection pooling.
A connection is direct when the
Connection pool option is not checked.
The first fields are self explanatory, enter the IP address or hostname in the
Server field, the port in
Port and type in the name of the database you want to use in the
User id and
Password are your login credentials.
Properties field allows you to specify any connection properties.
The recommended way to use connections is to use a connection pool. When you have a pool setup you check the
Connection Pool option and select your pool from the helper icon. This will give you something like this:
DB2Connection con1 = (DB2Connection) PoolManager.instance().getIPool("myPool").getConnection();
If the list of pooled connection is empty you need to configure your pools in 360's administration tool. Please see the help section for Pool Connections.