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 16E915287D for ; Mon, 20 Jun 2005 20:18:20 -0300 (ADT) 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 72893-09 for ; Mon, 20 Jun 2005 23:18:10 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 85ED55282C for ; Mon, 20 Jun 2005 20:18:08 -0300 (ADT) Received: (qmail 28723 invoked from network); 20 Jun 2005 23:16:13 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (64.7.143.116) by net2.micro-automation.com with SMTP; 20 Jun 2005 23:16:13 -0000 In-Reply-To: <42B661F6.4040009@yes2etl.com> References: <42B661F6.4040009@yes2etl.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-jdbc@postgresql.org, project@yes2etl.com, "Shankaramurthy Chockalingam" Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: JDBC Connectivity.. Date: Mon, 20 Jun 2005 19:18:05 -0400 To: Minal X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/109 X-Sequence-Number: 13071 Minal, Don't bother building it, just download it from jdbc.postgresql.org. Dave On 20-Jun-05, at 2:28 AM, Minal wrote: > I am noting down the steps..which I performed during installation > and for using JDBC.... > 1. DO we have to use ./configure with-java ? > because when I use that I get error that it failed. Is this the > reason I am not able to eshtablish the connectivity... > In O'reily book it is mentioned that we have to build the > driver...How does one do that?? > I have copied the postgresql driver in /usr/local/tomcat/common/lib > directory.. > also set the class path...restarted the tomcat and used the java > file as shown below... > > public class Example1 > >> >>{ >> >>public static void main(String[] argv) >> >>{ >> >> System.out.println("Checking if Driver is registerd"); >> >> try >> >> { >> >> Class.forName("org.postgresql.Driver"); >> >> } >> >> catch(ClassNotFoundException cnfe) >> >> { >> >> System.out.println("Couldn't find the Driver"); >> >> cnfe.printStackTrace(); >> >> System.exit(1); >> >> } >> >> System.out.println("registered the Driver OK, so lets make a >> >>connection"); >> >> Connection c = null; >> >> >> try >> >> { >> >> c= >>DriverManager.getConnection("jdbc:postgresql:// >> localhost/trainneedcorp","postgres","admin"); >> >> } >> >> catch(SQLException se) >> >> { >> >> System.out.println("Couldnt connect"); >> >> se.printStackTrace(); >> >> System.exit(1); >> >> } >> >> if(c != null) >> >> System.out.println("WE CONNECTED"); >> >> else >> >> System.out.println("Reaching here is not done"); >> >> } >> >> } >> > > >> >> I get the following error: >> >> >> >>java.lang.ClassNotFoundException: org.postgresql.Driver >> >> at java.net.URLClassLoader$1.run(URLClassLoader.java:199) >> >> at java.security.AccessController.doPrivileged(Native >> Method) >> >> at java.net.URLClassLoader.findClass(URLClassLoader.java: >> 187) >> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:289) >> >> at sun.misc.Launcher$AppClassLoader.loadClass >> (Launcher.java:274) >> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:235) >> >> at java.lang.ClassLoader.loadClassInternal >> (ClassLoader.java:302) >> >> at java.lang.Class.forName0(Native Method) >> >> at java.lang.Class.forName(Class.java >> > > Am I going wrong anywhere?? > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) > > Dave Cramer davec@postgresintl.com www.postgresintl.com ICQ #14675561 jabber davecramer@jabber.org ph (519 939 0336 )