Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id A9C289FB1CB for ; Sun, 26 Nov 2006 03:48:42 -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 85461-02 for ; Sun, 26 Nov 2006 03:48:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.224]) by postgresql.org (Postfix) with ESMTP id D24879FB1C4 for ; Sun, 26 Nov 2006 03:48:37 -0400 (AST) Received: by wx-out-0506.google.com with SMTP id i28so1281035wxd for ; Sat, 25 Nov 2006 23:48:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=W3MUGrrvcI3ivzo/TzlcsMSheJpJxJ0xXB5FSw4wCUVtEkCVbC1YG81/R3jAhmxHbM9np/uAFdY+gN9t0bjkduhX42AcpXUzGlJEh5Ob+AGpbu+6tkZApbaELyRVL3iFn1eDdu51cehhu2XQBmivguaTj9x7eHhyiOA+GGyHM1E= Received: by 10.90.84.17 with SMTP id h17mr9088463agb.1164527316820; Sat, 25 Nov 2006 23:48:36 -0800 (PST) Received: by 10.90.86.1 with HTTP; Sat, 25 Nov 2006 23:48:36 -0800 (PST) Message-ID: <9bc001470611252348l5fd9f93fx2c1a0d45b2c082bb@mail.gmail.com> Date: Sun, 26 Nov 2006 17:48:36 +1000 From: "Greg Peters" To: pgsql-jdbc@postgresql.org Subject: Exception Error - Please help I've tried everything! MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_127433_12723316.1164527316678" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.497 tagged_above=0 required=5 tests=BAYES_50, HTML_40_50, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200611/117 X-Sequence-Number: 16159 ------=_Part_127433_12723316.1164527316678 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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.... ------=_Part_127433_12723316.1164527316678 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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....

 

 

 

 

 

 

------=_Part_127433_12723316.1164527316678--