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 84A2253768 for ; Mon, 4 Apr 2005 12:15:09 +0100 (BST) 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 67837-10 for ; Mon, 4 Apr 2005 11:15:04 +0000 (GMT) Received: from skrisrv6.statkart.no (nospam.statkart.no [159.162.103.254]) by svr1.postgresql.org (Postfix) with ESMTP id 614B2535D3 for ; Mon, 4 Apr 2005 12:15:01 +0100 (BST) Received: from [159.162.84.139] ([159.162.84.139]) by skrisrv6.statkart.no (Netscape Messaging Server 4.15) with ESMTP id IEF5SB00.GJX for ; Mon, 4 Apr 2005 13:12:11 +0200 Message-ID: <425121BB.8020603@statkart.no> Date: Mon, 04 Apr 2005 13:15:07 +0200 From: "Espen Isaksen" User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Another java connect problem Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/11 X-Sequence-Number: 12618 Hi! I have studied all the different questions where people have trouble connecting to PostgreSQL through Java, but it doesn't help me much. This is a program I first compiled on a Mac and I have no problems at all there. Now I am on Fedora Linux. First my code: Connection dbcon; java.sql.Connection conn; String url = "jdbc:postgresql://localhost:5432/espen"; try { Class.forName("org.postgresql.Driver").newInstance(); } catch( ClassNotFoundException cnfex ) { System.out.println("Class not found!"); } //end catch conn = DriverManager.getConnection(url, "user", "password); Statement stmt = conn.createStatement(); s = conn.createStatement(); I compile by using this command: javac @files -classpath postgis.jar:postgresql.jar (where files include a list of all the .java files) No problems compiling. I try to run by: java road_generalization -verbose -classpath postgis.jar:postgresql.jar Then I get the usual error message: Unable to connect java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at DataUthenter.connectPostgres(DataUthenter.java:67) at DataUthenter.(DataUthenter.java:31) at road_generalization.(road_generalization.java:99) at road_generalization.main(road_generalization.java:383) I have tried to change the code in a lot of different ways, but it does not seem to help much. Can anybody give me some insight in why this doesn't work. Is my "run command" not correct? Espen Isaksen http://www.espenisaksen.com