You've identified part of my problem, I think.  From what I found, none of the 
documentation that talks about DataSource configuration mentions that <ResourceLink> 
is required (e.g. "JNDI Datasource HOW-TO").  They talk about using <resource-ref> in 
WEB.XML instead.  I assumed that if you had a <Context> element in SERVER.XML, then 
you could also add a <ResourceLink> within your <Context>.  If you don't have an 
explicit <Context> element (as we didn't), or you don't want to define a 
<ResourceLink>, then you could use <resource-ref> in WEB.XML.

Now that I've got it working, I can at least try the various configurations and decide 
what the option(s) are and whether there's truly a bug in 4.1.29.

Thanks for the info.

Jay

-----Original Message-----
From: Julio C�sar Aguilar [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 1:23 PM
To: Tomcat Users List
Subject: Re: JDBC/DBCP problems


> 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
[EMAIL PROTECTED]
Proyecto SIGC3, LANIA

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



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

Reply via email to