datasource issue
От | Tanu Shankar Bhatnagar |
---|---|
Тема | datasource issue |
Дата | |
Msg-id | 20030318224410.57229.qmail@web40302.mail.yahoo.com обсуждение исходный текст |
Ответ на | Re: jdbc/taglibs issue (Tony Grant <tony@tgds.net>) |
Список | 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
В списке pgsql-jdbc по дате отправления: