Thread: servlets and JDBC (postgresql 7.2)
I would like to establish a postgresql database connection from within a Java Servlet, using the Apache Tomcat server. Unfortunately, I get the error: "No suitable driver found" When trying to connect a Java application to the same database (same settings (same classpath)), everything works fine. Is there something special about JDBC and servlets, that might have caused this error? Thanks, Frederick __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Hi Frederick, Copy the postgresql JDBC driver "postgresql.jar" file to the TOMCAT-HOME/common/lib directory. Restart your tomcat server. That's it. Regards, Satish. --- Frederick Klauschen <fklauschen@yahoo.com> wrote: > I would like to establish a postgresql database > connection from within a Java Servlet, using > the Apache Tomcat server. > Unfortunately, I get the error: "No suitable driver > found" > When trying to connect a Java application to the > same database (same settings (same classpath)), > everything works fine. > Is there something special about JDBC and servlets, > that might have caused this error? > > Thanks, > Frederick > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! - Official partner of 2002 FIFA World Cup > http://fifaworldcup.yahoo.com > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to > majordomo@postgresql.org > > __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
I have the same setting here: pgSQL and Tomcat 4.0.x without any problem. You might want to check your setting and version of PostgreSQL and its JDBC. I can't help without detailed information? 6/23/2002 12:32:33 PM, Frederick Klauschen <fklauschen@yahoo.com> wrote: >I would like to establish a postgresql database >connection from within a Java Servlet, using >the Apache Tomcat server. >Unfortunately, I get the error: "No suitable driver >found" >When trying to connect a Java application to the >same database (same settings (same classpath)), >everything works fine. >Is there something special about JDBC and servlets, >that might have caused this error? > >Thanks, >Frederick > > > >__________________________________________________ >Do You Yahoo!? >Yahoo! - Official partner of 2002 FIFA World Cup >http://fifaworldcup.yahoo.com > > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > >
In-Reply-To: <20020624154045.62155.qmail@web12301.mail.yahoo.com> Satish-- I have my driver (jdbc7.1-1.2.jar) in TOMCAT-HOME/lib/. Things seem to be working OK. Can you tell me what's supposed to be the difference between common/lib and lib? Thanks, --John Hicks --- Nookala Satish Kumar <javasatish@yahoo.com>wrote: Hi Frederick, Copy the postgresql JDBC driver "postgresql.jar" file to the TOMCAT-HOME/common/lib directory. Restart your tomcat server. That's it. Regards, Satish. --- Frederick Klauschen <fklauschen@yahoo.com> wrote: > I would like to establish a postgresql database > connection from within a Java Servlet, using > the Apache Tomcat server. > Unfortunately, I get the error: "No suitable driver > found" > When trying to connect a Java application to the > same database (same settings (same classpath)), > everything works fine. > Is there something special about JDBC and servlets, > that might have caused this error? > > Thanks, > Frederick >
On Tue, 2002-06-25 at 08:24, John Hicks wrote: > In-Reply-To: > I have my driver (jdbc7.1-1.2.jar) in TOMCAT-HOME/lib/. > Things seem to be working OK. > > Can you tell me what's supposed to be the difference > between common/lib and lib? What version of Tomcat are you running? The location changed between 3.x and 4.0. It will change again between 4.0 and 4.1x ->. Cheers Tony Grant -- RedHat Linux on Sony Vaio C1XD/S http://www.animaproductions.com/linux2.html Macromedia UltraDev with PostgreSQL http://www.animaproductions.com/ultra.html
> > Can you tell me what's supposed to be the difference > > between common/lib and lib? as i understand it, /common/lib is where you stick libraries (jars etc) that you want your applications (webapps) to be able to make use of. so anything in this folder should be accessible in your servlets across all contexts, unlike putting it in the WEB-INF/lib of a particular context which makes it only available to that context. the /lib is where you stick stuff yto make it available to the tomcat server itself, but unless you're developing tomcat then i doubt you'd need this. however, the reason this works is because since its available to tomcat its available to your contexts as well. its a hierarchy. i must confestt that i do the same as you, i stick stuff in /lib since i've experienced wierdness putting it in common/lib. toby
>I have my driver (jdbc7.1-1.2.jar) in TOMCAT-HOME/lib/. >Things seem to be working OK. > >Can you tell me what's supposed to be the difference >between common/lib and lib? The latter is in applications' classpath, the former is *also* in Tomcat's classpath. You will need this if you want to use PostgreSQL for user authentication via the JDBCRealm. Best regards Rainer Klute Rainer Klute IT-Consulting GmbH Dipl.-Inform. Rainer Klute E-Mail: klute@rainer-klute.de Körner Grund 24 Telefon: +49 172 2324824 D-44143 Dortmund Telefax: +49 231 5349423