I am trying to configure a connection from Tomcat 4.1.18 to DB2 7.2
FixPack5 (NT, local DB2 client), and receive the following error message
when trying to open a connection to the database:

org.apache.commons.dbcp.DbcpException: COM.ibm.db2.jdbc.DB2Exception:
[IBM][CLI Driver] SQL0567N "SYSTEM" is not a valid authorization ID.
SQLSTATE=42602

The exception is thrown when trying to create the connection in the
following code:

javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)envx.lookup
("java:comp/env/jdbc/MyDB2");
java.sql.Connection connection = ds.getConnection();

The resource definition in server.xml is as follows:

            <Resource name="jdbc/MyDB2" auth="Container" type
="javax.sql.DataSource"/>

            <ResourceParams name="jdbc/MyDB2">
                  <parameter>
                        <name>user</name><value>db2admin</value>
                  </parameter>
                  <parameter>
                        <name>password</name><value>db2admin</value>
                  </parameter>
                  <parameter>
                        <name>driverClassName</name>
                        <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
                  </parameter>
                  <parameter>
                        <name>url</name>
                        <value>jdbc:db2:SAMPLE</value>
                  </parameter>
                  <parameter>
                        <name>maxActive</name>
                        <value>8</value>
                  </parameter>
                  <parameter>
                        <name>maxIdle</name>
                        <value>4</value>
                  </parameter>
                   <parameter>
                                <name>removeAbandoned</name>
                                <value>true</value>
                  </parameter>
                  <parameter>
                                <name>removeAbandonedTimeout</name>
                                <value>60</value>
                  </parameter>
                  <parameter>
                                <name>logAbandoned</name>
                                <value>true</value>
                              </parameter>
                  <parameter>
                        <name>maxWait</name>
                        <value>10000</value>
                  </parameter>
            </ResourceParams>

I have tried to connect using the same username and password by manually
creating a JDBC connection with the same driver (not using JNDI), and it
works fine:

Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
con = DriverManager.getConnection( "jdbc:db2:SAMPLE", "db2admin",
"db2admin" );

 It seems that Tomcat does not send the correct credentials (the ones
defined in the resourceparams in server.xml) when trying to connect to DB2
(it seems to send "SYSTEM" rather than "db2admin"). I have installed the
necessary jakarta components for connection pooling and I have made the IBM
driver classes available in the $CATALINA_HOME/common/lib directory. Hence,
I suspect that the problem originates in the connection pooling part of
Tomcat.

Have anyone experienced similar problems or have any idea about how to
solve this?

Any suggestions are greatly appreciated.

Regards
Vidar

B | vidar kongsli, consultant
E | +47 982 19 329, [EMAIL PROTECTED]
K | bekk consulting as, pb. 134 sentrum, 0102 oslo,
K | www.bekk.no




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to