I'm using tomcat 5.5, and postgresql 8.0.1 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 09, 2005 9:08 PM To: Tomcat Users List Subject: Re: Trying to connect tomcat5 with postgresql database
Sorry for the last post. Try this. InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/{app name}"); Connection con = ds.getConnection(); Are you using TC 5.0 or 5.5? > Should be Context ctx = new InitialContext(); > > > > Hello, > > I'm currently working with Tomcat5 on Solaris10 x86 machine. > > I'm running into problems when trying to access a postgresql 8.0.1 > > database on the local machine. Cannot create JDBC driver of class '' > > for connect URL null' is the error I receive when trying to establish a connection. > > Here's the snipet of code I used in my .jsp: > > > > Context ctx = new InitialConection(); > > > > DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/postDB"); > > > > Connection con = ds.getConnection(); > > > > I noticed it would compile fine if I remove the getConnection line. > > Once I add it back in, the above error appears. I've followed the > > instructions on the jakarta page, and thought I made the correct > > insertions in both server.xml, and WEB-INF/web.xml. Here are the > > entries > > used: > > server.xml > > <Resource auth="Container" > > description="PostgresSQL Connection Pool" > > name="jdbc/postDB" type="javax.sql.DataSource" > > driverClassName="org.postgresql.Driver" > > url="jdbc:postgresql://localhost:5432/test" > > /> > > <ResourceParams name="jdbc/postDB"> > > <parameter> > > <name>driverClassName</name> > > <value>org.postgresql.Driver</value> > > </parameter> > > <parameter> > > <name>url</name> > > > > <value>jdbc:postgresql://localhost:5432/test?autoConnect=true</value> > > </parameter> > > <parameter> > > <name>username</name> > > <value>postgres</value> > > </parameter> > > <parameter> > > <name>password</name> > > <value>postgres</value> > > </parameter> > > <parameter> > > <name>maxIdle</name> > > <value>2</value> > > </parameter> > > <parameter> > > <name>maxActive</name> > > <value>10</value> > > </parameter> > > </ResourceParams> > > Here is the web.xml: > > <resource-ref> > > <res-ref-name>jdbc/postDB</res-ref-name> > > <res-type>javax.sql.DataSource</res-type> > > <res-auth>Container</res-auth> > > </resource-ref> > > > > Thanks in advance! > > -Rick Mattier > > > > -------------------------------------------------------------------- > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]