Sorry, yes, 4.1.12.
Brian
|---------+--------------------------->
| | "Hari |
| | Venkatesan" |
| | <hvenkatesan@pfg|
| | c.com> |
| | |
| | 11/04/2002 11:10|
| | AM |
| | Please respond |
| | to "Tomcat Users|
| | List" |
| | |
|---------+--------------------------->
>-------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: "Tomcat Users List" <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: RE: JNDI results in Cannot Load JDBC Driver Class
|
>-------------------------------------------------------------------------------------------------------------------------------|
Which version of tomcat R u using?? 4.1.12 ? ?
Hari Venkatesan
Performance Food Group
Phone : 804 484 6263
-----Original Message-----
From: Brian Kautz [mailto:BKautz@;arnoldlogistics.com]
Sent: Monday, November 04, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: JNDI results in Cannot Load JDBC Driver Class
I have used connection pools with the mySQL database without difficulty.
Now I wish to use connection pools with the
com.ibm.as400.access.AS400JDBCDriver() driver. I can use this driver
for
direct connections without any problem, but when I try to use it in a
connection pool I get the error Cannot load JDBC driver class
'com.ibm.as400.access.AS400JDBCDriver()'.
I have the jt400.jar file in the tomcat CATALINA_HOME/common/lib
directory,
just like I do with my mySQL jar. Again, I know it is accessible by
Tomcat, since a direct call from a servlet (non-connection pool) works
just
fine with no errors.
Any suggestions on what may cause this exception and the remedies I
should
look into?
Here's some other details.....
My test servlet looks like this (important info only....). The first
(non
pool) example works fine. The second fails:
try {
out.println("<P>OK Here we go trying a regular
connection....");
// Load the AS/400 Toolbox for Java JDBC driver.
DriverManager.registerDriver(new
com.ibm.as400.access.AS400JDBCDriver());
// Get a connection to the database.
// Note the use of PROPERTIES to specify the date format
used.
// Using the iso format keeps errors from generating on
*loval
dates
connection = DriverManager.getConnection
("jdbc:as400://mysys;date format=iso;libraries=har harwhs;translate
binary=true","user","pass");
//... use this connection to access the database ...
Statement stmt = connection.createStatement();
queryRS = stmt.executeQuery(qry+user+"\'");
queryRS.next();
out.println("<P>The count is..."
+(queryRS.getBigDecimal(1).intValue()));
connection.close();
} catch (Exception e) {
// Should do output to STDERR here
System.out.println("<P>ERROR when connecting to database: "
+
e.getMessage());
connection = null;
}
try{
out.println("<P><P>OK Here we go trying pool....");
// Obtain our environment naming context
Context initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup
("java:comp/env/jdbc/hardata");
// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
//... use this connection to access the database ...
Statement stmt = conn.createStatement();
queryRS = stmt.executeQuery(qry+user+"\'");
queryRS.next();
out.println("<P>The count is..."
+(queryRS.getBigDecimal(1).intValue()));
conn.close();
} catch (Exception e) {
out.println("<P>ERROR!!!!!"+e.getMessage());
}
out.println("<P>Done with pooling");
out.flush();
out.close();
My Resource entry under the Context entry in server.xml is:
<Resource name="jdbc/hardata" auth
="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/hardata">
<parameter>
<name>validationQuery</name>
<value/>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>15</value>
</parameter>
<parameter>
<name>password</name>
<value>xxx</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:as400://mysys;date
format=iso;libraries=har harwhs;translate binary=true</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.ibm.as400.access.AS400JDBCDriver()</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>5</value>
</parameter>
<parameter>
<name>username</name>
<value>xxx</value>
</parameter>
</ResourceParams>
And my WEB.XML:
<resource-ref>
<description>
Connection to Har Data
</description>
<res-ref-name>jdbc/hardata</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <
mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <
mailto:tomcat-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>