From scmouli23@gmail.com Mon Feb 7 06:18:10 2005 X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9977D8B9CF8 for ; Mon, 7 Feb 2005 06:18:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99525-09 for ; Mon, 7 Feb 2005 06:17:55 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.196]) by svr1.postgresql.org (Postfix) with ESMTP id 8B7EE8B9B1B for ; Mon, 7 Feb 2005 06:17:54 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id z35so675939rne for ; Sun, 06 Feb 2005 22:17:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=lMxJ+7AntpKxmYuS/IOCpVFLD5S/X+fbK49ARN1Z8/cY60elWwQ53cbWOnAQo0GPIiqTsNY/oadaZP5/Atb1L6WCxvgVs39GjhG30Tx/Ge4CQRiUrImCTlmvn4vFdY5WbpkCLvYPvlZ+bJ9pb2nuYaU+XU829uFpBMHO3HA4SIA= Received: by 10.38.83.9 with SMTP id g9mr334411rnb; Sun, 06 Feb 2005 22:17:53 -0800 (PST) Received: by 10.38.163.52 with HTTP; Sun, 6 Feb 2005 22:17:53 -0800 (PST) Message-ID: Date: Mon, 7 Feb 2005 11:47:53 +0530 From: Chandra Mouli S Reply-To: Chandra Mouli S To: pgsql-jdbc@postgresql.org Subject: POSTGRES JBDC PROBLEM Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.905 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP, SUBJ_ALL_CAPS X-Spam-Level: X-Archive-Number: 200502/41 X-Sequence-Number: 12221 Hi, SUB: Problem in JDBC with POSTGRESQL I have installed POSTGRESQL 8.0 beta on my WINDOWS XP SP2. It is perfectly working and I had created a database 'Student' with table 'Details' The server is configured on PORT NO: 5432. I had unblocked the port no in IN-BUILT FIREWALL, to receive all requests. This is my Servlet program: ******************************************************* import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class Stud extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { try { int rNo=Integer.parseInt(req.getParameter("RegNo")); String Qry="select * from details where RNo=" + rNo; Connection con=null; Statement st=null; ResultSet rs=null; res.setContentType("text/html"); PrintWriter pw =res.getWriter(); pw.println(""); pw.println(""); pw.println("hellO"); try { pw.println("STEP 1 "); Class.forName("org.postgresql.Driver"); } catch(ClassNotFoundException cnfe) { pw.println("Exception CLASS NOT FOUND"); System.err.println("Count not find the Driver class"); cnfe.printStackTrace(); } con=DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/Student","scott", "tiger"); st=con.createStatement(); rs=st.executeQuery(Qry); rs.next(); int No=Integer.parseInt(rs.getString(1)); String Name=rs.getString(2); pw.println(No); pw.println(Name); pw.println(""); pw.println(""); con.close(); st.close(); } catch(Exception e) { PrintWriter pw =res.getWriter(); pw.println(e); } } } ****************************************************************************************** I had downloaded the latest postgresql driver 'postgresql-8.0-310.jdbc3.jar ' from postgres.org I had tried all these: 1) set the classpath to this particular jar file. 2) located the javahome directory thro HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/*/JavaHome entry in registry and placed my jdbc jar file in that directory. ie c:\jre1.5.0_01\lib and \ext 3) placed my jdbc jar file in c:\jdk1.5.0_01\lib, c:\jdk1.5.0_01\jre\lib and \ext. I my running TOMCAT SERVER 5.0 and when I invoke the servlet after passing the parameter values from a HTML page, the following result in a new page is generated: hellO STEP 1 Exception CLASS NOT FOUND java.sql.SQLException: No suitable driver The JVM is failing to locate the POSTGRESQL driver - thro the Class.forName("org.postgresql.Driver"); command. The execution is not going beyond this command and hence the problem is strictly with locating and using the POSTGRESQL driver for JDBC. Hence I would like anyone of u to help me getting out of this trouble as soon as possible. I am in a tight project and because of this everything is pending. Please explain me in details all the problem in using JDBC for POSTGRES in a WINDOWS PLATFORM. If possible tell me place to get a correct POSTGRESQL JDBC driver... all sites just point me to the jdbc.postgres.org page. Please help me as soon as possible. Yours truly, Chandra Mouli.S INDIA. scmouli23@gmail.com scmouli23@yahoo.com From iain@mst.co.jp Mon Feb 7 09:57:34 2005 X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF4298B9B58 for ; Mon, 7 Feb 2005 09:57:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27695-09 for ; Mon, 7 Feb 2005 09:57:24 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id 5CFE48B9C1E for ; Mon, 7 Feb 2005 09:57:24 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j179v1Q19844; Mon, 7 Feb 2005 18:57:01 +0900 Message-ID: <001101c50cfb$c6498a00$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Chandra Mouli S" , References: Subject: Re: POSTGRES JBDC PROBLEM Date: Mon, 7 Feb 2005 18:59:50 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/42 X-Sequence-Number: 12222 Hi, This is stretching my memory as I havn't touched tomcat for a while, but I think that you should place the jar file in the tomcat deployment directory with all the other jar files and class files that your application uses. In short, tomcat manages it's own class paths - or ateast it does so for the applications deployed under it. Placing the jar file in the places you did will never work as I understand it. I hope that makes sense, and morover, I hope it helps, regards Iain ----- Original Message ----- From: "Chandra Mouli S" To: Sent: Monday, February 07, 2005 3:17 PM Subject: [JDBC] POSTGRES JBDC PROBLEM > Hi, > SUB: Problem in JDBC with POSTGRESQL > > I have installed POSTGRESQL 8.0 beta on my WINDOWS XP SP2. > > It is perfectly working and I had created a database 'Student' with > table 'Details' > > The server is configured on PORT NO: 5432. > > I had unblocked the port no in IN-BUILT FIREWALL, to receive all requests. > > > > This is my Servlet program: > > ******************************************************* > > > import javax.servlet.*; > import javax.servlet.http.*; > import java.io.*; > import java.sql.*; > > public class Stud extends HttpServlet { > > public void doPost(HttpServletRequest req, HttpServletResponse res) throws > > ServletException,IOException { > > try { > > int rNo=Integer.parseInt(req.getParameter("RegNo")); > String Qry="select * from details where RNo=" + rNo; > Connection con=null; > Statement st=null; > ResultSet rs=null; > > res.setContentType("text/html"); > PrintWriter pw =res.getWriter(); > > > pw.println(""); > pw.println(""); > pw.println("hellO"); > > try > { > pw.println("STEP 1 "); > Class.forName("org.postgresql.Driver"); > > } catch(ClassNotFoundException cnfe) > { > pw.println("Exception CLASS NOT FOUND"); > System.err.println("Count not find the Driver class"); > cnfe.printStackTrace(); > } > > > > con=DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/Student","scott", > "tiger"); > st=con.createStatement(); > rs=st.executeQuery(Qry); > rs.next(); > int No=Integer.parseInt(rs.getString(1)); > String Name=rs.getString(2); > > pw.println(No); > pw.println(Name); > > pw.println(""); > pw.println(""); > con.close(); > st.close(); > } > catch(Exception e) { > PrintWriter pw =res.getWriter(); > pw.println(e); > } > > > } > } > ****************************************************************************************** > > > I had downloaded the latest postgresql driver > 'postgresql-8.0-310.jdbc3.jar ' from postgres.org > > > I had tried all these: > > 1) set the classpath to this particular jar file. > > 2) located the javahome directory thro > HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java > Runtime Environment/*/JavaHome entry in registry and placed my jdbc > jar file in that directory. > > ie c:\jre1.5.0_01\lib and \ext > > 3) placed my jdbc jar file in > c:\jdk1.5.0_01\lib, c:\jdk1.5.0_01\jre\lib and \ext. > > > I my running TOMCAT SERVER 5.0 and when I invoke the servlet after passing > the > parameter values from a HTML page, > > the following result in a new page is generated: > > > hellO STEP 1 Exception CLASS NOT FOUND java.sql.SQLException: No suitable > driver > > > > The JVM is failing to locate the POSTGRESQL driver - thro the > > Class.forName("org.postgresql.Driver"); command. > > The execution is not going beyond this command and hence the problem > is strictly with locating > > and using the POSTGRESQL driver for JDBC. > > > Hence I would like anyone of u to help me getting out of this trouble > as soon as possible. > I am in a tight project and because of this everything is pending. > > Please explain me in details all the problem in using JDBC for > POSTGRES in a WINDOWS PLATFORM. > > > If possible tell me place to get a correct POSTGRESQL JDBC driver... > all sites just point me to > > the jdbc.postgres.org page. > > > > Please help me as soon as possible. > > > > Yours truly, > Chandra Mouli.S > INDIA. > > scmouli23@gmail.com > scmouli23@yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From btj@havleik.no Mon Feb 7 10:11:01 2005 X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24D388B9B49 for ; Mon, 7 Feb 2005 10:11:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29739-08 for ; Mon, 7 Feb 2005 10:10:50 +0000 (GMT) Received: from gandalf.havleik.no (gw2.havleik.no [217.8.139.61]) by svr1.postgresql.org (Postfix) with ESMTP id C0A3B8B9C97 for ; Mon, 7 Feb 2005 10:10:50 +0000 (GMT) Received: from [127.0.0.1] (gandalf.havleik.no [10.1.1.1]) by gandalf.havleik.no (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id j17AAHmK001307; Mon, 7 Feb 2005 11:10:17 +0100 Message-ID: <42073E8A.1060004@havleik.no> Date: Mon, 07 Feb 2005 11:10:18 +0100 From: =?ISO-8859-1?Q?Bj=F8rn_T_Johansen?= Organization: Havleik Consulting User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Iain Cc: Chandra Mouli S , pgsql-jdbc@postgresql.org Subject: Re: POSTGRES JBDC PROBLEM References: <001101c50cfb$c6498a00$7201a8c0@mst1x5r347kymb> In-Reply-To: <001101c50cfb$c6498a00$7201a8c0@mst1x5r347kymb> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Havleik-MailScanner-Information: Please contact Havleik Consulting for more information X-Havleik-MailScanner: Found to be clean X-MailScanner-From: btj@havleik.no X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/43 X-Sequence-Number: 12223 Or you could just place the jar file under $TOMCAT/common/lib and it should work... >( BTJ Iain wrote: > Hi, > > This is stretching my memory as I havn't touched tomcat for a while, but > I think that you should place the jar file in the tomcat deployment > directory with all the other jar files and class files that your > application uses. > > In short, tomcat manages it's own class paths - or ateast it does so for > the applications deployed under it. Placing the jar file in the places > you did will never work as I understand it. > > I hope that makes sense, and morover, I hope it helps, > regards > Iain > > > ----- Original Message ----- From: "Chandra Mouli S" > To: > Sent: Monday, February 07, 2005 3:17 PM > Subject: [JDBC] POSTGRES JBDC PROBLEM > > >> Hi, >> SUB: Problem in JDBC with POSTGRESQL >> >> I have installed POSTGRESQL 8.0 beta on my WINDOWS XP SP2. >> >> It is perfectly working and I had created a database 'Student' with >> table 'Details' >> >> The server is configured on PORT NO: 5432. >> >> I had unblocked the port no in IN-BUILT FIREWALL, to receive all >> requests. >> >> >> >> This is my Servlet program: >> >> ******************************************************* >> >> >> import javax.servlet.*; >> import javax.servlet.http.*; >> import java.io.*; >> import java.sql.*; >> >> public class Stud extends HttpServlet { >> >> public void doPost(HttpServletRequest req, HttpServletResponse res) >> throws >> >> ServletException,IOException { >> >> try { >> >> int rNo=Integer.parseInt(req.getParameter("RegNo")); >> String Qry="select * from details where RNo=" + rNo; >> Connection con=null; >> Statement st=null; >> ResultSet rs=null; >> >> res.setContentType("text/html"); >> PrintWriter pw =res.getWriter(); >> >> >> pw.println(""); >> pw.println(""); >> pw.println("hellO"); >> >> try >> { >> pw.println("STEP 1 "); >> Class.forName("org.postgresql.Driver"); >> >> } catch(ClassNotFoundException cnfe) >> { >> pw.println("Exception CLASS NOT FOUND"); >> System.err.println("Count not find the Driver class"); >> cnfe.printStackTrace(); >> } >> >> >> >> con=DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/Student","scott", >> >> "tiger"); >> st=con.createStatement(); >> rs=st.executeQuery(Qry); >> rs.next(); >> int No=Integer.parseInt(rs.getString(1)); >> String Name=rs.getString(2); >> >> pw.println(No); >> pw.println(Name); >> >> pw.println(""); >> pw.println(""); >> con.close(); >> st.close(); >> } >> catch(Exception e) { >> PrintWriter pw =res.getWriter(); >> pw.println(e); >> } >> >> >> } >> } >> ****************************************************************************************** >> >> >> >> I had downloaded the latest postgresql driver >> 'postgresql-8.0-310.jdbc3.jar ' from postgres.org >> >> >> I had tried all these: >> >> 1) set the classpath to this particular jar file. >> >> 2) located the javahome directory thro >> HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java >> Runtime Environment/*/JavaHome entry in registry and placed my jdbc >> jar file in that directory. >> >> ie c:\jre1.5.0_01\lib and \ext >> >> 3) placed my jdbc jar file in >> c:\jdk1.5.0_01\lib, c:\jdk1.5.0_01\jre\lib and \ext. >> >> >> I my running TOMCAT SERVER 5.0 and when I invoke the servlet after >> passing the >> parameter values from a HTML page, >> >> the following result in a new page is generated: >> >> >> hellO STEP 1 Exception CLASS NOT FOUND java.sql.SQLException: No >> suitable driver >> >> >> >> The JVM is failing to locate the POSTGRESQL driver - thro the >> >> Class.forName("org.postgresql.Driver"); command. >> >> The execution is not going beyond this command and hence the problem >> is strictly with locating >> >> and using the POSTGRESQL driver for JDBC. >> >> >> Hence I would like anyone of u to help me getting out of this trouble >> as soon as possible. >> I am in a tight project and because of this everything is pending. >> >> Please explain me in details all the problem in using JDBC for >> POSTGRES in a WINDOWS PLATFORM. >> >> >> If possible tell me place to get a correct POSTGRESQL JDBC driver... >> all sites just point me to >> >> the jdbc.postgres.org page. >> >> >> >> Please help me as soon as possible. >> >> >> >> Yours truly, >> Chandra Mouli.S >> INDIA. >> >> scmouli23@gmail.com >> scmouli23@yahoo.com >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster