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 78B9753380 for ; Tue, 5 Apr 2005 13:09:32 +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 15163-02 for ; Tue, 5 Apr 2005 12:09:22 +0000 (GMT) Received: from localhost.localdomain (unknown [206.103.146.133]) by svr1.postgresql.org (Postfix) with ESMTP id 311C65337E for ; Tue, 5 Apr 2005 13:09:21 +0100 (BST) Received: from [10.10.90.120] ([206.103.146.150]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id j35DAa8m026130; Tue, 5 Apr 2005 09:10:37 -0400 Message-ID: <42527FE4.70902@fastcrypt.com> Date: Tue, 05 Apr 2005 08:09:08 -0400 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Espen Isaksen Cc: pgsql-jdbc@postgresql.org Subject: Re: Another java connect problem References: <425121BB.8020603@statkart.no> In-Reply-To: <425121BB.8020603@statkart.no> 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200504/26 X-Sequence-Number: 12633 Hi, What is the postgis.jar doing? Does it still implement it's own version of the jdbc driver ? the newinstance thing doesn't matter it will still work that way. Try it without the postgis.jar, it may be loading its version of the driver. Dave Espen Isaksen wrote: > 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 > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561