tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bell, Buck (c)" <Buck_B...@tvratings.com>
Subject RE: problem with SQL tags
Date Mon, 18 Nov 2002 16:43:14 GMT
Hi John,

My $.02.  Although I'm not using MySQL, my experience with Tomcat 4.1.12 has
been that I must place the JDBC Driver classes in the Tomcat common/lib
directory.  Although this is somewhat in contrast to the JSTL and other
JARs, I found that including the JDBC driver classes in WEB-INF/lib not only
caused the error you described, it did so even when I had the JARs in both
locations.  So, you might want to try including the classes ONLY in
common/lib.  Of course, once you get the JAR issue resolved, setting up a
JNDI DataSource (with a pooled connection) is even better.

Best of luck,
Buck Bell

-----Original Message-----
From: John C Cartwright [mailto:John.C.Cartwright@noaa.gov]
Sent: Monday, November 18, 2002 11:32 AM
To: Tag Libraries Users List
Subject: Re: problem with SQL tags


Thank you for your reply, Hans.  The JDBC driver classes are in the 
webapps WEB-INF/lib directory and I was assuming that  they are being 
found because a non-JSTL JSP page with a scriptlet block containing:

Connection con;
try {
   Class.forName("org.gjt.mm.mysql.Driver");
   con = 
DriverManager.getConnection("jdbc:mysql://myhost.noaa.gov:3306/testdb","test
user","testpass"); 

   } catch (Exception e) {
      throw (new ServletException("Error loading Driver: " 
+e.getMessage()));
   }


seems to work fine.  Does JSTL look for the Driver classes in a location 
other than the scriplet-based connection code?

Thanks again!

-- john





Hans Bergsten wrote:

> John C Cartwright wrote:
>
>> Hello All,
>>
>> I am hoping that someone can help me to get going with the SQL tags. 
>> I'm trying to connect to a mysql database using tomcat4.1.12 and 
>> version 1.0.2 of the library.
>>
>> Here's my JSP:
>>
>> <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
>> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
>>
>> <HTML>
>> <HEAD>
>> </HEAD>
>> <BODY>
>> <sql:setDataSource var="monitorDS"
>>    url="jdbc:mysql://myhost.noaa.gov:3306/testdb"
>>    driver="org.gjt.mm.mysql.Driver"
>>    user="testuser"
>>    password="testpass"
>> />
>> </BODY>
>> </HTML>
>>
>> I'm getting a:
>> org.apache.jasper.JasperException: Unable to get connection, 
>> DataSource invalid: "No suitable driver"
>
>
> This is because the JDBC driver classes are not found by the web
> container. Make sure you have installed them in the WEB-INF/lib
> directory of the application.
>
> > [...]
>
> Hans



-- 
=====================================================
John Cartwright
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6284
John.C.Cartwright@noaa.gov
=====================================================




--
To unsubscribe, e-mail:
<mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:taglibs-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message