Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9E8BC9FA492 for ; Sun, 26 Nov 2006 11:46:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 91705-08 for ; Sun, 26 Nov 2006 11:46:28 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.188]) by postgresql.org (Postfix) with ESMTP id C3EFF9FA48A for ; Sun, 26 Nov 2006 11:46:34 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so1956571nfb for ; Sun, 26 Nov 2006 07:46:32 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eAsxouMgpffTz2NF4nFQ74xL53Pip+Uhgzzu7EGTZHDQ+7qZK0vdQLZJhhC01DKy8afk2XFT/y9XOq30AHDmvNoOn43ReCZ67GTyPpuA5WTh3mzk5gMwHfcuZDy41P2dV3R0pYSh2uR3eZCmgIfrjnYhl/ev+kyIH1zSUtvxr9w= Received: by 10.49.68.20 with SMTP id v20mr1266724nfk.1164555992552; Sun, 26 Nov 2006 07:46:32 -0800 (PST) Received: by 10.48.208.3 with HTTP; Sun, 26 Nov 2006 07:46:32 -0800 (PST) Message-ID: <883e44790611260746h5b75162eue52207ee6505e2a7@mail.gmail.com> Date: Sun, 26 Nov 2006 07:46:32 -0800 From: "Chuck Davis" To: pgsql-jdbc@postgresql.org Subject: Re: Exception Error - Please help I've tried everything! In-Reply-To: <9bc001470611252348l5fd9f93fx2c1a0d45b2c082bb@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9bc001470611252348l5fd9f93fx2c1a0d45b2c082bb@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=BAYES_50, SPF_PASS X-Spam-Level: X-Archive-Number: 200611/123 X-Sequence-Number: 16165 Greg: If you're running from inside NB you need to add the PG driver as a library to NB. If you have the driver on your classpath then your class should run fine outside of NB. Test and let us know if it runs outside of NB or if you have success adding the driver as a library in NB. I use Postgresql and it works beautifully. Be encouraged that if you get the right combo you'll have a superior environment! Chuck On 11/25/06, Greg Peters wrote: > Hello all, > > I'm trying to get the following simple program to run just to confirm a > connection to the database: > > //PostgresqlClient.java > > import java.sql.*; > > public class PostgresqlClient{ > public static void main(String[] arguments) > throws ClassNotFoundException, SQLException{ > > String driver = "org.postgresql.Driver"; > String url ="localhost"; > String user = "root"; > String pwd = "password"; > > Class.forName(driver); > > Connection con = DriverManager.getConnection(url, user, pwd); > System.err.println("Connection complete"); > > con.close(); > } > } > > > > I keep getting the folowing errors: > > Exception in thread "main" java.lang.ClassNotFoundException: > org.postgresql.Driver > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) > at java.lang.ClassLoader.loadClass(ClassLoader.java:251) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:164) > at PostgresqlClient.main(PostgresqlClient.java:12) > Java Result: 1 > BUILD SUCCESSFUL (total time: 0 seconds) > > I have tried adding the postgresql.jar file to my CLASSPATH, and have also > tried copying the postgresql.jar file to the same directory as the > PostgresqlClient.java and PostgresqlClient.class directories. I have also > tried running the following from the command line: > > java -classpath postgresql.jar PostgresqlClient.class > > I am using jdk1.5.0_09 and have tried using nearly all the available > postgresql.jar files available. > > Any advice would be most appreciated. > > Cheers, > > Greg Peters.... > >