I didn't work on DB2 before, but i have configured Oracle and MySql
database in the same way.

First, you have to get the ideal connector for DB2, jar file, and
place it inside CATALINA_HOME/lib, or JAVA_HOME/lib/ext.

Second, Define your resource name, you already did.

Thrid: Add extra information in your web.xml file like the following:
<resource-ref>
      <description>Oracle Datasource example</description>
      <res-ref-name>jdbc/db2universal</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>

After that, you have to connect your Resource name to the your server.
In context.xml add the following line of code:

<ResourceLink global="jdbc/db2universal" name="jdbc/db2universal"
type="javax.sql.DataSource"/>

One last thing, please note that you have to change the previous
parameters according to your database. Hope that will help
On 7/27/07, dileep_sivaraman <[EMAIL PROTECTED]> wrote:
>
> Hi ,
>
> I am trying to register a com.ibm.db2.jcc.DB2ConnectionPoolDataSource
> datasource in tomcat 5.5.4.
>
> I am not getting any exception's while doing a context lookup and gives me
> the datasource.
> However the paramaeter's that are set with that Resource are always null.
>
> Server.xml
> <GlobalNamingResources>
> <Resource name="jdbc/db2universal"
> type="com.ibm.db2.jcc.DB2ConnectionPoolDataSource"
> factory="com.ibm.db2.jcc.DB2DataSourceFactory"
> serverName="PROD9S03.bankofamerica.com" username="abc" password="abc"/>
>
> </GlobalNamingResources>
>
> In my code  I get the datasource as :
>
> connPoolDataSource=(DB2ConnectionPoolDataSource)
> envContext.lookup("jdbc/db2universal");
>
> However when I print out the serverName parameter that has been set in the
> resource it prints null.
>
> System.out.println("connPoolDataSource.getServerName()
> :"+connPoolDataSource.getServerName());
>
> OUTPUT:
>
> connPoolDataSource.getServerName() :null
>
>
> Can somebody tell me what I  am doing wrong?
> --
> View this message in context:
> http://www.nabble.com/registering-a-DB2ConnectionPoolDataSource-in-tomcat--5.5-tf4155802.html#a11823991
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to