tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julio César Aguilar <jagui...@lania.mx>
Subject Re: JDBC/DBCP problems
Date Wed, 28 Jan 2004 19:22:52 GMT

> Tomcat version is 4.1.29 on Windows XP.  I'm attempting to connect to
> SQL Server.  The JDBC driver JARs are in CATALINA_HOME\common\lib, and
> since everything works fine if I manually load the driver via
> Class.forName(), I don't think my problem is related to my driver files
> location.  When attempting to use getConnection(), however, I get the
> dreaded "Cannot create JDBC driver of class '' for connect URL 'null',
> cause: No suitable driver" error.  The highlights of my configuration
> are below.

Two comments:

1. You don't mention a ResourceLink. When you define a Resource as global, you 
need to use a ResourceLink in the definition of the context of the application. 
In your case, something like

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

inside the Context tag of the server.xml COULD work.

2. I'm saying COULD in the previous comment because I had the same problem and 
could not solve it with Tomcat 4.1.29.
Using 5.0.16 or 5.0.18 everything works fine.

I have something like:

----------------------------
server.xml
----------------------------
<GlobalNamingResources>
<Resource name="GlobalDataSource" auth="Container" type="javax.sql.DataSource"
description="The database." />
     <ResourceParams name="GlobalDataSource">
     ...
     </ResourceParams>
</GlobalNamingResources>


---------------------------
Catalina/host/myapp.xml
---------------------------
<Context ...>
<ResourceLink global="GlobalDataSource" name="jdbc/mydb" 
type="javax.sql.DataSource" />
</Context>


Note that there's no need of using a resource-ref in web.xml.

-----------------------------------
Julio César Aguilar Cabrera
jaguilar@lania.mx
Proyecto SIGC3, LANIA

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message