Hi All, I am using Tomcat 5.5.17 and tried running a sample datasource application using the Cloudscape database. I have added the driver jar into common/lib directory.
The context.xml has following configuration for datasource <Resource auth="Container" name="jdbc/MyDB" type="javax.sql.DataSource" password="password" driverClassName="com.ibm.db2j.jdbc.DB2jDriver" maxIdle="4" testOnBorrow="true" validationQuery="select 1" username="user" url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB" timeBetweenEvictionRunsMillis="30000" maxActive="8"/> I have created a datasource using the admin application and it added following entry in server.xml <Resource name="jdbc/MyDB" type="javax.sql.DataSource" password="password" driverClassName="com.ibm.db2j.jdbc.DB2jDriver" maxIdle="2" maxWait="5000" username="user" url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB" maxActive="4"/> The appliaction has a jsp page with following code Connection con = null; Statement stmt = null; try { Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/MyDB"); System.out.println("Got DataSource\n"); con = ds.getConnection(); System.out.println("Got Connection\n"); } catch(java.lang.Exception e) { e.printStackTrace(); System.err.print(e.getClass().getName()); System.err.println(e.getMessage()); } try { stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM assignment"); ............ ............ The application gets deployed ok but when I access the jsp page I get the following exception org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnection Factory (Syntax error: Encountered "<EOF>" at line 1, column 8.) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo urce.java:855) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc e.java:540) at org.apache.jsp.dbdemo1_jsp._jspService(dbdemo1_jsp.java:59) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:332) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 48) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86 9) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc essConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint .java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow erWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java:684) at java.lang.Thread.run(Thread.java:595) Caused by: SQL Exception: Syntax error: Encountered "<EOF>" at line 1, column 8. at db2j.ai.j.generateCsSQLException(Unknown Source) at db2j.ai.g.wrapInSQLException(Unknown Source) at db2j.ai.g.handleException(Unknown Source) at db2j.ai.c.handleException(Unknown Source) at db2j.ai.e.handleException(Unknown Source) at db2j.ai.m.execute(Unknown Source) at db2j.ai.m.executeQuery(Unknown Source) at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingS tatement.java:205) at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection (PoolableConnectionFactory.java:328) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(Ba sicDataSource.java:879) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo urce.java:851) ... 22 more org.apache.tomcat.dbcp.dbcp.SQLNestedExceptionCannot create PoolableConnectionFactory (Syntax error: Encountered "<EOF>" at line 1, column 8.) java.lang.NullPointerException at org.apache.jsp.dbdemo1_jsp._jspService(dbdemo1_jsp.java:70) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:332) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 48) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86 9) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc essConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint .java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow erWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java:684) at java.lang.Thread.run(Thread.java:595) java.lang.NullPointerExceptionnull Please help. Regards, Jitendra Kharche Geometric Software Solutions Co. Ltd. Work: +91-20-2290 6351 ******************************************************************** This e-mail communication and any attachments are privileged and confidential and intended only for the use of the recipients named above. If you are not the intended recipient, please do not review, disclose, disseminate, distribute or copy this e-mail and attachments. If you have received this communication in error, please notify the sender immediately by email or telephone at+91-20-22906351. ********************************************************************* --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]