From: | Tanu Shankar Bhatnagar <tanushankar(at)yahoo(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Cc: | Tony Grant <tony(at)tgds(dot)net> |
Subject: | datasource issue |
Date: | 2003-03-18 22:44:10 |
Message-ID: | 20030318224410.57229.qmail@web40302.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I ran into jdbc driver not being found by tomcat issue, which I solved by
putting pg73jdbc3.jar in common/lib in tomcat. Now I am trying to look up
a data source through JNDI in my servlet and jstl-jsp both, but it is
failing in both cases. Assuming that it has got to do with the drivers not
being found, I have tried the following:
1. put the drivers in common/lib, server/lib, shared/lib and of course
WEB-INF/lib
2. put the drivers in java_home/lib/ext
3. add the drivers explicitly in catalina.sh
None if this worked, though I managed to change the error message from 'No
suitable driver' to 'Cannot load JDBC driver class 'null''.
I have followed the instructions from tomcat site to create my datasource,
and to modify my web.xml appropriately.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
I am using tomcat4.0.1, jdk1.4.1_01, red hat 8.0, jstl 1.0 implementation
from sun, postgresql 7.3.2 with jdbc drivers pg73jdbc3.jar.
Any help on this issue will be appreciated.
Thanks,
Tanu
ps: Tony, I did change the db url to what you suggested, but that did not
make a difference.
Here is the error snippet I get:
java.sql.SQLException: Cannot load JDBC driver class 'null'
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
at TestServlet.doGet(TestServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Code snippet from Servlet:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/test");
Connection conn = ds.getConnection();
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(CATEGORY_SQL);
while(rs.next()) {
// get stuff
}
Code snippet from jsp:
<sql:setDataSource
var="example"
dataSource="jdbc/test"
/>
<sql:transaction dataSource="${example}">
<sql:query var="deejays">
SELECT name, description FROM category
</sql:query>
</sql:transaction>
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-03-19 01:18:33 | Re: WARNING on setAutoCommit |
Previous Message | Tony Grant | 2003-03-18 07:19:38 | Re: jdbc/taglibs issue |