I had to add the IBM DB2 Jars to the <glassfish_home>/lib or <glassfish_home>/domains/domain1/<lib> directory to get GlassFish to see the libraries. (We didn't want to pay for Data Direct drivers). Here is the snippet of domain.xml for DB2 configuration as you must also force the driver in Type 4 mode and change the parameter names to get it to work. copy the below in your resources section and edit accordingly:
<jdbc-resource enabled="true" jndi-name="jdbc/<YOUR_DS_NAME_HERE>" object-type="user" pool-name="<YOUR_POOL_NAME_HERE>">
<description><DESCRIPTION></description>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.ibm.db2.jcc.DB2ConnectionPoolDataSource" fail-all-connections="true" idle-timeout-in-seconds="140" is-connection-validation-required="true" is-isolation-level-guaranteed="false" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="YOUR_POOL_NAME_HERE>" non-transactional-connections="false" pool-resize-quantity="32" res-type="javax.sql.ConnectionPoolDataSource" statement-timeout-in-seconds="-1" steady-pool-size="0" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<description><YOUR_POOL_NAME_HERE_DESCRIPTION></description>
<property name="user" value="<USERNAME>"/>
<property name="password" value="<PASSWORD>"/>
<property name="portNumber" value="<PORTNUMBER>"
<property name="databaseName" value="DATABASE_NAME"/>
<property name="serverName" value="<SERVER_NAME>"/>
<property name="driverType" value="4"/>
</jdbc-connection-pool>
The configuration parameters are basically default otherwise. For use behind firewalls you have to change the pool setting to be more aggressive to avoid consistent disconnect exceptions. For example, change resize quantity to be equal to max size. We worked with the GlassFish team to figure out the firewall issues. GlassFish version 2 has a much improved pooling mechanism and you may not need the more agressive configurations.
[Message sent by forum member 'byteme' (byteme)]
http://forums.java.net/jive/thread.jspa?messageID=221350