Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 3EB42BBDD49 for ; Fri, 18 Nov 2011 05:09:44 -0400 (AST) Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=smadev.internal.net) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RRKS7-0004UA-Fk for pgsql-jdbc@postgresql.org; Fri, 18 Nov 2011 09:09:45 +0000 Received: from smadev.internal.net (localhost.internal.net [127.0.0.1]) by smadev.internal.net (8.14.2/8.14.2) with ESMTP id pAI99Swq008644; Fri, 18 Nov 2011 11:09:28 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by smadev.internal.net (8.14.2/8.14.2/Submit) id pAI99SPR008643; Fri, 18 Nov 2011 11:09:28 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-jdbc@postgresql.org Subject: Tomcat7 connection pool with postgresql Date: Fri, 18 Nov 2011 12:09:27 +0300 User-Agent: KMail/1.9.7 Cc: users@tomcat.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201111181109.28089.achill@matrix.gatewaynet.com> X-Archive-Number: 201111/47 X-Sequence-Number: 22382 Hello, although i have been a jboss/postgresql admin/dba for ages, it seems that i am stuck with tomcat. i am trying in tomcat7 to set a connection pool'ed data source with postgresql. i was following the tomcat7 docs here : http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#PostgreSQL My server.xml portion looks as follows : ... my app's web.xml resource-ref goes as follows : postgreSQL Datasource sia jdbc/postgres javax.sql.DataSource Container in my .jsp this code fails (ommiting boilerplate) InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup( "java:/comp/env/jdbc/postgres" ); Connection con=null; try { con = ds.getConnection(); con.setAutoCommit(true); } catch () {...} finally {...} with : org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452) org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) org.apache.jsp.index_jsp._jspService(index_jsp.java:102) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) root cause java.sql.SQLException: No suitable driver java.sql.DriverManager.getDriver(DriverManager.java:279) org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) org.apache.jsp.index_jsp._jspService(index_jsp.java:102) .... However if i do the classic standalone classloading : Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql://localhost/sia?user=springuser&password=springuser"; con = DriverManager.getConnection(url); it works ok. To be honest, i haven't done any extensive reading on those matters, besides the official tomcat docs, but time constraints are far too restrictive. Thank you all for your time! PS users from the tomcat list, pls include my address since i am not subscribed in your list. -- Achilleas Mantzios