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 927D35293E for ; Mon, 27 Jun 2005 15:22:28 -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 70735-04 for ; Mon, 27 Jun 2005 18:22:26 +0000 (GMT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.72]) by svr1.postgresql.org (Postfix) with ESMTP id 04045528CE for ; Mon, 27 Jun 2005 15:22:24 -0300 (ADT) Received: from mac.com (smtpin02-en2 [10.13.10.147]) by smtpout.mac.com (Xserve/8.12.11/smtpout15/MantshX 4.0) with ESMTP id j5RIMGE5000459; Mon, 27 Jun 2005 11:22:16 -0700 (PDT) Received: from [192.168.14.230] (customer-148-233-147-133.uninet-ide.com.mx [148.233.147.133] (may be forged)) (authenticated bits=0) by mac.com (Xserve/smtpin02/MantshX 4.0) with ESMTP id j5RIMDPP025893; Mon, 27 Jun 2005 11:22:15 -0700 (PDT) In-Reply-To: <42BCEA21.6040100@opencloud.com> References: <1836DA42-89E0-486D-8DB3-A4715AD0F81F@mac.com> <42BCEA21.6040100@opencloud.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 Content-Transfer-Encoding: 7bit From: Enrique Ibarra Subject: Re: Problems loading the driver Date: Mon, 27 Jun 2005 13:22:11 -0500 To: Oliver Jowett X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/137 X-Sequence-Number: 13099 Oliver, thank you very much for your quick response. It seems that I will have to check this problem with Apple support. The jar driver is in fact in the CLASSPATH variable but somehow its value is not being correctly read by java. I was originally working with Xcode (Apple's IDE). I tried specifying both the CLASSPATH environment variable and java's -cp switch in the IDE but it did not work. Then I switched to old-fashioned emacs and a command terminal and I was able to make the program run, but only when I specify the -cp option in the java command line. If I do not specify the -cp switch then the program does not run (even though the jar driver is in the CLASSPATH). I have not been able to make this program run from the Xcode IDE. Here is the output of the command terminal to illustrate this problem. Thanks again. {~/Ixe/Proyectos/tarme}% javac actgastos.java {~/Ixe/Proyectos/tarme}% echo $CLASSPATH /usr/local/lib/postgresql.jar:.: {~/Ixe/Proyectos/tarme}% java actgastos gastos.csv org.postgresql.Driver 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:141) at actgastos.main(actgastos.java:8) No suitable driver java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java:532) at java.sql.DriverManager.getConnection(DriverManager.java:171) at actgastos.main(actgastos.java:15) {~/Ixe/Proyectos/tarme}% java -cp /usr/local/lib/postgresql.jar:.: actgastos gastos.csv {~/Ixe/Proyectos/tarme}% On Jun 25, 2005, at 12:22 AM, Oliver Jowett wrote: > enrique.ibarra@mac.com wrote: > > >> The JDBC jar file IS in the CLASSPATH environment variable. The >> code of >> the program is the following: >> > > >> org.postgresql.Driver >> java.lang.ClassNotFoundException: org.postgresql.Driver >> > > This means that the driver jar *isn't* in your classpath. > > What is the exact value of your CLASSPATH, have you exported the > CLASSPATH environment variable, where have you placed the driver jar, > and what is the Java command line you are trying? > > -O >