tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Yoesting <>
Subject Re: DB2 DataSources and Tomcat 4.0.4
Date Fri, 30 Aug 2002 20:44:23 GMT

We're using DB2 via DataSource with Tomcat 4.0.3 using Struts 
(<data-source> element in struts-config.xml), so I assume this means it 
should work without Struts also. Below is a JSP snippet that should tell 
you if you're driver is working or not outside of Tomcat's Resource 

 From what I gathered in your previous posts, you're using I think you should be using

As for where to put the driver -- we renamed the .zip file to .jar and 
put it in <CATALINA_HOME>/common/lib.

One last thought -- make sure DB2's JDBC Applet Server/Listener is 

Good luck,


<%@ page language="java" import="java.util.*,java.sql.*" %>
try {
   	Statement stmt = conn.createStatement();
   	ResultSet rs = stmt.executeQuery("select * from sometable");

	while ( {
		// do something

  } catch (SQLException sqle) {
  	// handle SQLException
  } catch (Exception e) {
  	// handle exception

On Thursday, August 29, 2002, at 05:34 PM, Vance Christiaanse wrote:

> Tomcat fans,
> I've been trying to configure a DataSource in Tomcat 4.0.4 to use DB2 
> for...
> well, for longer than I'd like to admit. I've searched the web and
> experimented with jars vs. zips, with renaming them vs. rebuilding them,
> with the lib folder vs. the common\lib folder, with "url" vs. 
> "driverName",
> and so on.
> As a sanity check, I just tried switching my server.xml driverClassName 
> and
> driverName to values appropriate for Cloudscape and put the requisite 
> jar
> files in common\lib. The DataSource in my servlet worked fine the first
> time! (And for the first time ever!)
> I believe there is an issue with the DB2 driver involving native 
> libraries
> and classloaders. I suspect that Tomcat works just fine with drivers 
> (e.g.
> Cloudscape) that don't use native libraries.
> I'm sending this because I hope it
> (1) helps others who are trying to get DB2 working via a DataSource in
> Tomcat
> (2) inspires those who know more about this to tell us about it--
>     In particular, has *anyone* *ever* gotten this to work?
> Vance
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-
> For additional commands, e-mail: <mailto:tomcat-user-

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message