pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedjava.sql.SQLException: No suitable driver
17+ messages / 9 participants
[nested] [flat]
* java.sql.SQLException: No suitable driver
@ 2005-05-10 17:24 boleguy@adinet.com.uy
2005-05-10 17:32 ` Re: java.sql.SQLException: No suitable driver Nelson Arapé <narape@ica.luz.ve>
2005-05-10 17:38 ` Re: java.sql.SQLException: No suitable driver Franco Bruno Borghesi <fborghesi@gmail.com>
0 siblings, 2 replies; 17+ messages in thread
From: boleguy@adinet.com.uy @ 2005-05-10 17:24 UTC (permalink / raw)
To: pgsql-jdbc
HI:
I'M TRYING TO CONNECT AN ECLIPSE 3.01 IDE RUNNING ON WINDOWS XP WITH A DB
POSTGRESQL VERSION 7.4.7. I USED THE FOLLOWINGS DRIVERS: PG.74.213/4/5/6.JDBC3.JAR
AND NO ONE WORKS.
THE MESSAGE WAS THE FOLLOWING:
Cargando clase
IWAV0055I Java Bean frenchconn.connpost started with the main method
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at frenchconn.connpost.agregarCliente(connpost.java:33)
at frenchconn.connpost.main(connpost.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(JavaBeansLauncher.java:86)
AND THE CODE (MY CODE):
import java.sql.*;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
//import samples.jdbc.JDBCTest;
/**
* @author Benjamin
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class connpost {
static {
System.out.println("Cargando clase");
}
public void agregarCliente(long idCliente,
String nombre) {
try {
String url = "jdbc:postgres://172.16.100.110:5432/benjamin";
Connection conn = null;
conn = DriverManager.getConnection(url,"benjamin", "benja1");
DriverManager.getDriver("org.postgresql.Driver");
String sql =
"INSERT INTO Cliente " +
"(IdCliente, Nombre) " +
"VALUES (?,?)";
PreparedStatement ps =
conn.prepareStatement(sql);
ps.setLong(1, idCliente);
ps.setString(2, nombre);
ps.executeUpdate();
ps.close();
conn.close();
System.out.println("Cliente insertado OK");
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
try {
// Cargo el driver JDBC de postgres
Class.forName("org.postgresql.Driver");
connpost conn = new connpost();
//jdbcTest.agregarCliente(1, "Pepe");
//jdbcTest.agregarCliente(2, "Juan");
conn.agregarCliente(123,"pepe");
// jdbcTest.transaccion();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
THANKS FOR EVERYTHING TO ANYONE
BENJAMIN
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2005-05-10 17:24 java.sql.SQLException: No suitable driver boleguy@adinet.com.uy
@ 2005-05-10 17:32 ` Nelson Arapé <narape@ica.luz.ve>
1 sibling, 0 replies; 17+ messages in thread
From: Nelson Arapé @ 2005-05-10 17:32 UTC (permalink / raw)
To: pgsql-jdbc
Probably it is a classpath isue, Are you sure that the driver's jar is in the
classpath of the project?
Bya
Nelson Arapé
El Mar 10 May 2005 13:24, boleguy@adinet.com.uy escribió:
> HI:
> I'M TRYING TO CONNECT AN ECLIPSE 3.01 IDE RUNNING ON WINDOWS XP WITH A DB
> POSTGRESQL VERSION 7.4.7. I USED THE FOLLOWINGS DRIVERS:
> PG.74.213/4/5/6.JDBC3.JAR AND NO ONE WORKS.
>
> THE MESSAGE WAS THE FOLLOWING:
> Cargando clase
> IWAV0055I Java Bean frenchconn.connpost started with the main method
> java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(Unknown Source)
> at java.sql.DriverManager.getConnection(Unknown Source)
> at frenchconn.connpost.agregarCliente(connpost.java:33)
> at frenchconn.connpost.main(connpost.java:69)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(J
>avaBeansLauncher.java:86)
>
> AND THE CODE (MY CODE):
>
> import java.sql.*;
> import java.sql.DriverManager;
> import java.sql.PreparedStatement;
>
> //import samples.jdbc.JDBCTest;
>
>
> /**
> * @author Benjamin
> *
> * TODO To change the template for this generated type comment go to
> * Window - Preferences - Java - Code Style - Code Templates
> */
> public class connpost {
>
> static {
> System.out.println("Cargando clase");
> }
>
> public void agregarCliente(long idCliente,
> String nombre) {
> try {
> String url = "jdbc:postgres://172.16.100.110:5432/benjamin";
> Connection conn = null;
> conn = DriverManager.getConnection(url,"benjamin", "benja1");
> DriverManager.getDriver("org.postgresql.Driver");
>
> String sql =
> "INSERT INTO Cliente " +
> "(IdCliente, Nombre) " +
> "VALUES (?,?)";
>
> PreparedStatement ps =
> conn.prepareStatement(sql);
>
> ps.setLong(1, idCliente);
> ps.setString(2, nombre);
>
> ps.executeUpdate();
>
> ps.close();
>
> conn.close();
>
> System.out.println("Cliente insertado OK");
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> public static void main(String[] args) {
>
> try {
> // Cargo el driver JDBC de postgres
> Class.forName("org.postgresql.Driver");
>
> connpost conn = new connpost();
> //jdbcTest.agregarCliente(1, "Pepe");
> //jdbcTest.agregarCliente(2, "Juan");
> conn.agregarCliente(123,"pepe");
>
> // jdbcTest.transaccion();
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
> }
>
>
> THANKS FOR EVERYTHING TO ANYONE
>
> BENJAMIN
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2005-05-10 17:24 java.sql.SQLException: No suitable driver boleguy@adinet.com.uy
@ 2005-05-10 17:38 ` Franco Bruno Borghesi <fborghesi@gmail.com>
1 sibling, 0 replies; 17+ messages in thread
From: Franco Bruno Borghesi @ 2005-05-10 17:38 UTC (permalink / raw)
To: boleguy@adinet.com.uy <boleguy@adinet.com.uy>; +Cc: pgsql-jdbc
ok, but you don't need to shout! :P
Two things:
1)have you added your jar to the project's java build path? (if you did, go
to the second) right click on the project name, select Properties, go to Java
Build Path, go to the Libraries tab, click Add External Jars and find your
pgxxxxxxxxxx.jar
2) be sure to load the driver first doing a Class.forName("
org.postgresql.Driver"); in your code. Also check your url, it should be
"jdbc:postgresql://172.16.100.110:5432/benjamin"
If it works, have a mate for me ;-)
2005/5/10, boleguy@adinet.com.uy <boleguy@adinet.com.uy>:
>
> HI:
> I'M TRYING TO CONNECT AN ECLIPSE 3.01 IDE RUNNING ON WINDOWS XP WITH A DB
> POSTGRESQL VERSION 7.4.7. I USED THE FOLLOWINGS DRIVERS: PG.74.213
> /4/5/6.JDBC3.JAR
> AND NO ONE WORKS.
>
> THE MESSAGE WAS THE FOLLOWING:
> Cargando clase
> IWAV0055I Java Bean frenchconn.connpost started with the main method
> java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(Unknown Source)
> at java.sql.DriverManager.getConnection(Unknown Source)
> at frenchconn.connpost.agregarCliente(connpost.java:33)
> at frenchconn.connpost.main(connpost.java:69)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(
> JavaBeansLauncher.java:86)
>
> AND THE CODE (MY CODE):
>
> import java.sql.*;
> import java.sql.DriverManager;
> import java.sql.PreparedStatement;
>
> //import samples.jdbc.JDBCTest;
>
> /**
> * @author Benjamin
> *
> * TODO To change the template for this generated type comment go to
> * Window - Preferences - Java - Code Style - Code Templates
> */
> public class connpost {
>
> static {
> System.out.println("Cargando clase");
> }
>
> public void agregarCliente(long idCliente,
> String nombre) {
> try {
> String url = "jdbc:postgres://172.16.100.110:5432/benjamin";
> Connection conn = null;
> conn = DriverManager.getConnection(url,"benjamin", "benja1");
> DriverManager.getDriver("org.postgresql.Driver");
>
> String sql =
> "INSERT INTO Cliente " +
> "(IdCliente, Nombre) " +
> "VALUES (?,?)";
>
> PreparedStatement ps =
> conn.prepareStatement(sql);
>
> ps.setLong(1, idCliente);
> ps.setString(2, nombre);
>
> ps.executeUpdate();
>
> ps.close();
>
> conn.close();
>
> System.out.println("Cliente insertado OK");
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> public static void main(String[] args) {
>
> try {
> // Cargo el driver JDBC de postgres
> Class.forName("org.postgresql.Driver");
>
> connpost conn = new connpost();
> //jdbcTest.agregarCliente(1, "Pepe");
> //jdbcTest.agregarCliente(2, "Juan");
> conn.agregarCliente(123,"pepe");
>
> // jdbcTest.transaccion();
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
> }
>
> THANKS FOR EVERYTHING TO ANYONE
>
> BENJAMIN
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* java.sql.SQLException: No suitable driver
@ 2006-03-10 07:44 Yunush Mulla <mullayunush@yahoo.co.in>
2006-03-10 07:48 ` Re: java.sql.SQLException: No suitable driver Brendan Duddridge <brendan@clickspace.com>
2006-03-10 19:25 ` Re: java.sql.SQLException: No suitable driver Kris Jurka <books@ejurka.com>
0 siblings, 2 replies; 17+ messages in thread
From: Yunush Mulla @ 2006-03-10 07:44 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
I m developing a application in which i need to connect to postgres Database lying on remote host.
when I tried to connect to remote database Using following code:
connection=DriverManager.getConnection("jdbc:postgresql://"+host+":"+port+"/sms",user,pwd);
I got error like this:
java.sql.SQLException: No suitable driver
what could be the cause? What could be the solution???
---------------------------------
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-03-10 07:44 java.sql.SQLException: No suitable driver Yunush Mulla <mullayunush@yahoo.co.in>
@ 2006-03-10 07:48 ` Brendan Duddridge <brendan@clickspace.com>
1 sibling, 0 replies; 17+ messages in thread
From: Brendan Duddridge @ 2006-03-10 07:48 UTC (permalink / raw)
To: Yunush Mulla <mullayunush@yahoo.co.in>; +Cc: pgsql-jdbc
That usually means your jdbc driver can't be found in your java
classpath.
____________________________________________________________________
Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com
ClickSpace Interactive Inc.
Suite L100, 239 - 10th Ave. SE
Calgary, AB T2G 0V9
http://www.clickspace.com
On Mar 10, 2006, at 12:44 AM, Yunush Mulla wrote:
> Hi,
> I m developing a application in which i need to connect to
> postgres Database lying on remote host.
> when I tried to connect to remote database Using following code:
>
> connection=DriverManager.getConnection("jdbc:postgresql://"+host
> +":"+port+"/sms",user,pwd);
>
> I got error like this:
> java.sql.SQLException: No suitable driver
>
> what could be the cause? What could be the solution???
>
>
> Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
Attachments:
smime.p7s (application/pkcs7-signature, 2.3K) download
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-03-10 07:44 java.sql.SQLException: No suitable driver Yunush Mulla <mullayunush@yahoo.co.in>
@ 2006-03-10 19:25 ` Kris Jurka <books@ejurka.com>
1 sibling, 0 replies; 17+ messages in thread
From: Kris Jurka @ 2006-03-10 19:25 UTC (permalink / raw)
To: Yunush Mulla <mullayunush@yahoo.co.in>; +Cc: pgsql-jdbc
On Thu, 9 Mar 2006, Yunush Mulla wrote:
> connection=DriverManager.getConnection("jdbc:postgresql://"+host+":"+port+"/sms",user,pwd);
>
> java.sql.SQLException: No suitable driver
>
Have you done a Class.forName("org.postgresql.Driver"); ?
Kris Jurka
^ permalink raw reply [nested|flat] 17+ messages in thread
* java.sql.SQLException: No suitable driver
@ 2006-04-27 12:19 Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 17+ messages in thread
From: Mads N. Vestergaard @ 2006-04-27 12:19 UTC (permalink / raw)
To: pgsql-jdbc
Hi Everybody, when I try to run my program, I get the following error message:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Database.<init>(Database.java:20)
at Gateway.main(Gateway.java:19)
Exception in thread "main" java.lang.NullPointerException
at Database.SQLget(Database.java:71)
at Gateway.main(Gateway.java:33)
My connect code is:
try {
Class.forName("org.postgresql.Driver");
}catch (ClassNotFoundException e){
}
try {
db = DriverManager.getConnection("jdbc:postgresql://hostname/" + dbName,"bruger","kode");
} catch (SQLException e) {
e.printStackTrace();
}
On my system I have putted the jdbc driver for postgres into the classpath:
hostname:~$ echo $CLASSPATH
/usr/share/java/pg74.216.jdbc3.jar
Java version:
hostname:~$ java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
As far as I know it should work since, it is correct in the classpath. I have also tried with other postgres jdbc drivers. In my IDE(Eclipse), it works fine, but on my production server it gives the error.
I've also tried to run the program with the -classpath flag, with the same result.
Have I simply forgotten something, or is there something seriously wrong?
Thanks in advance.
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
@ 2006-04-27 13:25 ` Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
0 siblings, 1 reply; 17+ messages in thread
From: Dave Cramer @ 2006-04-27 13:25 UTC (permalink / raw)
To: Mads N. Vestergaard <mnv@timmy.dk>; +Cc: pgsql-jdbc
5 will get you 10 that your class path isn't setup correctly. Try
adding ex.printStackTrace() to the catch handler for Class.forName
Dave
On 27-Apr-06, at 8:19 AM, Mads N. Vestergaard wrote:
> Hi Everybody, when I try to run my program, I get the following
> error message:
> java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(Unknown Source)
> at java.sql.DriverManager.getConnection(Unknown Source)
> at Database.<init>(Database.java:20)
> at Gateway.main(Gateway.java:19)
> Exception in thread "main" java.lang.NullPointerException
> at Database.SQLget(Database.java:71)
> at Gateway.main(Gateway.java:33)
> My connect code is:
> try {
> Class.forName("org.postgresql.Driver");
> }catch (ClassNotFoundException e){
> }
> try {
> db = DriverManager.getConnection("jdbc:postgresql://
> hostname/" + dbName,"bruger","kode");
> } catch (SQLException e) {
> e.printStackTrace();
> }
> On my system I have putted the jdbc driver for postgres into the
> classpath:
> hostname:~$ echo $CLASSPATH
> /usr/share/java/pg74.216.jdbc3.jar
> Java version:
> hostname:~$ java -version
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
> As far as I know it should work since, it is correct in the
> classpath. I have also tried with other postgres jdbc drivers. In
> my IDE(Eclipse), it works fine, but on my production server it
> gives the error.
> I've also tried to run the program with the -classpath flag, with
> the same result.
> Have I simply forgotten something, or is there something seriously
> wrong?
> Thanks in advance.
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
@ 2006-04-27 13:31 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 17+ messages in thread
From: Mads N. Vestergaard @ 2006-04-27 13:31 UTC (permalink / raw)
To: pgsql-jdbc
Well, it gives me:
java.lang.ClassNotFoundException: org.postgresql.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Database.<init>(Database.java:16)
at Gateway.main(Gateway.java:19)
But I think you're right... But my problem is, that if I try to run it
with the classpath flag, and also the classpath environment vartiable,
it fails.
The path is correct.
I believe that I have overseen something, but I have looked over the
setup a dusin of times now, and I can't spot it.
Dave Cramer wrote:
> 5 will get you 10 that your class path isn't setup correctly. Try
> adding ex.printStackTrace() to the catch handler for Class.forName
>
> Dave
> On 27-Apr-06, at 8:19 AM, Mads N. Vestergaard wrote:
>
>> Hi Everybody, when I try to run my program, I get the following error message:
>> java.sql.SQLException: No suitable driver
>> at java.sql.DriverManager.getConnection(Unknown Source)
>> at java.sql.DriverManager.getConnection(Unknown Source)
>> at Database.(Database.java:20)
>> at Gateway.main(Gateway.java:19)
>> Exception in thread "main" java.lang.NullPointerException
>> at Database.SQLget(Database.java:71)
>> at Gateway.main(Gateway.java:33)
>> My connect code is:
>> try {
>> Class.forName("org.postgresql.Driver");
>> }catch (ClassNotFoundException e){
>> }
>> try {
>> db = DriverManager.getConnection("jdbc:postgresql://hostname/" + dbName,"bruger","kode");
>> } catch (SQLException e) {
>> e.printStackTrace();
>> }
>> On my system I have putted the jdbc driver for postgres into the classpath:
>> hostname:~$ echo $CLASSPATH
>> /usr/share/java/pg74.216.jdbc3.jar
>> Java version:
>> hostname:~$ java -version
>> java version "1.5.0_06"
>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
>> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
>> As far as I know it should work since, it is correct in the classpath. I have also tried with other postgres jdbc drivers. In my IDE(Eclipse), it works fine, but on my production server it gives the error.
>> I've also tried to run the program with the -classpath flag, with the same result.
>> Have I simply forgotten something, or is there something seriously wrong?
>> Thanks in advance.
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
@ 2006-04-27 13:43 ` Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
0 siblings, 1 reply; 17+ messages in thread
From: Dave Cramer @ 2006-04-27 13:43 UTC (permalink / raw)
To: Mads N. Vestergaard <mnv@timmy.dk>; +Cc: pgsql-jdbc
Mads,
What is your classpath.
inevitably this is the problem.
Dave
On 27-Apr-06, at 9:31 AM, Mads N. Vestergaard wrote:
> Well, it gives me:
>
> java.lang.ClassNotFoundException: org.postgresql.Driver
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at Database.<init>(Database.java:16)
> at Gateway.main(Gateway.java:19)
>
> But I think you're right... But my problem is, that if I try to run
> it with the classpath flag, and also the classpath environment
> vartiable, it fails.
> The path is correct.
>
> I believe that I have overseen something, but I have looked over
> the setup a dusin of times now, and I can't spot it.
>
>
> Dave Cramer wrote:
>> 5 will get you 10 that your class path isn't setup correctly. Try
>> adding ex.printStackTrace() to the catch handler for Class.forName
>>
>> Dave
>> On 27-Apr-06, at 8:19 AM, Mads N. Vestergaard wrote:
>>
>>> Hi Everybody, when I try to run my program, I get the following
>>> error message:
>>> java.sql.SQLException: No suitable driver
>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>> at Database.(Database.java:20)
>>> at Gateway.main(Gateway.java:19)
>>> Exception in thread "main" java.lang.NullPointerException
>>> at Database.SQLget(Database.java:71)
>>> at Gateway.main(Gateway.java:33)
>>> My connect code is:
>>> try {
>>> Class.forName("org.postgresql.Driver");
>>> }catch (ClassNotFoundException e){
>>> }
>>> try {
>>> db = DriverManager.getConnection("jdbc:postgresql://
>>> hostname/" + dbName,"bruger","kode");
>>> } catch (SQLException e) {
>>> e.printStackTrace();
>>> }
>>> On my system I have putted the jdbc driver for postgres into the
>>> classpath:
>>> hostname:~$ echo $CLASSPATH
>>> /usr/share/java/pg74.216.jdbc3.jar
>>> Java version:
>>> hostname:~$ java -version
>>> java version "1.5.0_06"
>>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-
>>> b05)
>>> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
>>> As far as I know it should work since, it is correct in the
>>> classpath. I have also tried with other postgres jdbc drivers. In
>>> my IDE(Eclipse), it works fine, but on my production server it
>>> gives the error.
>>> I've also tried to run the program with the -classpath flag, with
>>> the same result.
>>> Have I simply forgotten something, or is there something
>>> seriously wrong?
>>> Thanks in advance.
>>
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
@ 2006-04-27 13:46 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 17+ messages in thread
From: Mads N. Vestergaard @ 2006-04-27 13:46 UTC (permalink / raw)
To: pgsql-jdbc
Hi Dave,
My Classpath is:
hostname:~$ echo $CLASSPATH
/usr/share/java/pg74.216.jdbc3.jar
And the file exists:
hostname:~$ ls -la /usr/share/java/pg74.216.jdbc3.jar
-rwxr-xr-x 1 root root 210371 2006-04-27 09:52 /usr/share/java/pg74.216.jdbc3.jar
Dave Cramer wrote:
> Mads,
>
> What is your classpath.
>
> inevitably this is the problem.
>
> Dave
> On 27-Apr-06, at 9:31 AM, Mads N. Vestergaard wrote:
>
>> Well, it gives me:
>>
>> java.lang.ClassNotFoundException: org.postgresql.Driver
>> at java.net.URLClassLoader$1.run(Unknown Source)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>> at java.lang.Class.forName0(Native Method)
>> at java.lang.Class.forName(Unknown Source)
>> at Database.<init>(Database.java:16)
>> at Gateway.main(Gateway.java:19)
>>
>> But I think you're right... But my problem is, that if I try to run
>> it with the classpath flag, and also the classpath environment
>> vartiable, it fails.
>> The path is correct.
>>
>> I believe that I have overseen something, but I have looked over the
>> setup a dusin of times now, and I can't spot it.
>>
>>
>> Dave Cramer wrote:
>>> 5 will get you 10 that your class path isn't setup correctly. Try
>>> adding ex.printStackTrace() to the catch handler for Class.forName
>>>
>>> Dave
>>> On 27-Apr-06, at 8:19 AM, Mads N. Vestergaard wrote:
>>>
>>>> Hi Everybody, when I try to run my program, I get the following error message:
>>>> java.sql.SQLException: No suitable driver
>>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>>> at Database.(Database.java:20)
>>>> at Gateway.main(Gateway.java:19)
>>>> Exception in thread "main" java.lang.NullPointerException
>>>> at Database.SQLget(Database.java:71)
>>>> at Gateway.main(Gateway.java:33)
>>>> My connect code is:
>>>> try {
>>>> Class.forName("org.postgresql.Driver");
>>>> }catch (ClassNotFoundException e){
>>>> }
>>>> try {
>>>> db = DriverManager.getConnection("jdbc:postgresql://hostname/" + dbName,"bruger","kode");
>>>> } catch (SQLException e) {
>>>> e.printStackTrace();
>>>> }
>>>> On my system I have putted the jdbc driver for postgres into the classpath:
>>>> hostname:~$ echo $CLASSPATH
>>>> /usr/share/java/pg74.216.jdbc3.jar
>>>> Java version:
>>>> hostname:~$ java -version
>>>> java version "1.5.0_06"
>>>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
>>>> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
>>>> As far as I know it should work since, it is correct in the classpath. I have also tried with other postgres jdbc drivers. In my IDE(Eclipse), it works fine, but on my production server it gives the error.
>>>> I've also tried to run the program with the -classpath flag, with the same result.
>>>> Have I simply forgotten something, or is there something seriously wrong?
>>>> Thanks in advance.
>>>
>>
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
@ 2006-04-27 13:56 ` Dave Cramer <pg@fastcrypt.com>
2006-04-28 09:11 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
0 siblings, 1 reply; 17+ messages in thread
From: Dave Cramer @ 2006-04-27 13:56 UTC (permalink / raw)
To: Mads N. Vestergaard <mnv@timmy.dk>; +Cc: pgsql-jdbc
Mads,
And how do you execute the program ? One thing that can help is to
run java -verbose to see what it is doing.
Dave
On 27-Apr-06, at 9:46 AM, Mads N. Vestergaard wrote:
> Hi Dave,
> My Classpath is:
> hostname:~$ echo $CLASSPATH
> /usr/share/java/pg74.216.jdbc3.jar
>
> And the file exists:
> hostname:~$ ls -la /usr/share/java/pg74.216.jdbc3.jar
> -rwxr-xr-x 1 root root 210371 2006-04-27 09:52 /usr/share/java/
> pg74.216.jdbc3.jar
>
>
> Dave Cramer wrote:
>> Mads,
>>
>> What is your classpath.
>>
>> inevitably this is the problem.
>>
>> Dave
>> On 27-Apr-06, at 9:31 AM, Mads N. Vestergaard wrote:
>>
>>> Well, it gives me:
>>>
>>> java.lang.ClassNotFoundException: org.postgresql.Driver
>>> at java.net.URLClassLoader$1.run(Unknown Source)
>>> at java.security.AccessController.doPrivileged(Native
>>> Method)
>>> at java.net.URLClassLoader.findClass(Unknown Source)
>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown
>>> Source)
>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Unknown Source)
>>> at Database.<init>(Database.java:16)
>>> at Gateway.main(Gateway.java:19)
>>>
>>> But I think you're right... But my problem is, that if I try to
>>> run it with the classpath flag, and also the classpath
>>> environment vartiable, it fails.
>>> The path is correct.
>>>
>>> I believe that I have overseen something, but I have looked over
>>> the setup a dusin of times now, and I can't spot it.
>>>
>>>
>>> Dave Cramer wrote:
>>>> 5 will get you 10 that your class path isn't setup correctly.
>>>> Try adding ex.printStackTrace() to the catch handler for
>>>> Class.forName
>>>>
>>>> Dave
>>>> On 27-Apr-06, at 8:19 AM, Mads N. Vestergaard wrote:
>>>>
>>>>> Hi Everybody, when I try to run my program, I get the following
>>>>> error message:
>>>>> java.sql.SQLException: No suitable driver
>>>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>>>> at Database.(Database.java:20)
>>>>> at Gateway.main(Gateway.java:19)
>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>> at Database.SQLget(Database.java:71)
>>>>> at Gateway.main(Gateway.java:33)
>>>>> My connect code is:
>>>>> try {
>>>>> Class.forName("org.postgresql.Driver");
>>>>> }catch (ClassNotFoundException e){
>>>>> }
>>>>> try {
>>>>> db = DriverManager.getConnection("jdbc:postgresql://
>>>>> hostname/" + dbName,"bruger","kode");
>>>>> } catch (SQLException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>> On my system I have putted the jdbc driver for postgres into
>>>>> the classpath:
>>>>> hostname:~$ echo $CLASSPATH
>>>>> /usr/share/java/pg74.216.jdbc3.jar
>>>>> Java version:
>>>>> hostname:~$ java -version
>>>>> java version "1.5.0_06"
>>>>> Java(TM) 2 Runtime Environment, Standard Edition (build
>>>>> 1.5.0_06-b05)
>>>>> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode,
>>>>> sharing)
>>>>> As far as I know it should work since, it is correct in the
>>>>> classpath. I have also tried with other postgres jdbc drivers.
>>>>> In my IDE(Eclipse), it works fine, but on my production server
>>>>> it gives the error.
>>>>> I've also tried to run the program with the -classpath flag,
>>>>> with the same result.
>>>>> Have I simply forgotten something, or is there something
>>>>> seriously wrong?
>>>>> Thanks in advance.
>>>>
>>>
>>
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
@ 2006-04-28 09:11 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:03 ` Re: java.sql.SQLException: No suitable driver Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 17+ messages in thread
From: Mads N. Vestergaard @ 2006-04-28 09:11 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
Well it gives me a lot of debug information. http://timmy.dk/debug.txt .
I ran:
hostname:~$ java -verbose -cp /usr/share/java/pg74.216.jdbc3.jar -jar
program.jar
Dave Cramer wrote:
> Mads,
>
> And how do you execute the program ? One thing that can help is to run
> java -verbose to see what it is doing.
>
> Dave
> On 27-Apr-06, at 9:46 AM, Mads N. Vestergaard wrote:
>
>> Hi Dave,
>> My Classpath is:
>> hostname:~$ echo $CLASSPATH
>> /usr/share/java/pg74.216.jdbc3.jar
>>
>> And the file exists:
>> hostname:~$ ls -la /usr/share/java/pg74.216.jdbc3.jar
>> -rwxr-xr-x 1 root root 210371 2006-04-27 09:52 /usr/share/java/pg74.216.jdbc3.jar
>>
>>
>> Dave Cramer wrote:
>>> Mads,
>>>
>>> What is your classpath.
>>>
>>> inevitably this is the problem.
>>>
>>> Dave
>>> On 27-Apr-06, at 9:31 AM, Mads N. Vestergaard wrote:
>>>
>>>> Well, it gives me:
>>>>
>>>> java.lang.ClassNotFoundException: org.postgresql.Driver
>>>> at java.net.URLClassLoader$1.run(Unknown Source)
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at java.net.URLClassLoader.findClass(Unknown Source)
>>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>> at java.lang.Class.forName0(Native Method)
>>>> at java.lang.Class.forName(Unknown Source)
>>>> at Database.<init>(Database.java:16)
>>>> at Gateway.main(Gateway.java:19)
>>>>
>>>> But I think you're right... But my problem is, that if I try to run
>>>> it with the classpath flag, and also the classpath environment
>>>> vartiable, it fails.
>>>> The path is correct.
>>>>
>>>> I believe that I have overseen something, but I have looked over
>>>> the setup a dusin of times now, and I can't spot it.
>>>>
>>>>
>>>> Dave Cramer wrote:
>>>>> 5 will get you 10 that your class path isn't setup correctly. Try
>>>>> adding ex.printStackTrace() to the catch handler for Class.forName
>>>>>
>>>>> Dave
>>>>> On 27-Apr-06, at 8:19 AM, Mads N. Vestergaard wrote:
>>>>>
>>>>>> Hi Everybody, when I try to run my program, I get the following error message:
>>>>>> java.sql.SQLException: No suitable driver
>>>>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>>>>> at java.sql.DriverManager.getConnection(Unknown Source)
>>>>>> at Database.(Database.java:20)
>>>>>> at Gateway.main(Gateway.java:19)
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at Database.SQLget(Database.java:71)
>>>>>> at Gateway.main(Gateway.java:33)
>>>>>> My connect code is:
>>>>>> try {
>>>>>> Class.forName("org.postgresql.Driver");
>>>>>> }catch (ClassNotFoundException e){
>>>>>> }
>>>>>> try {
>>>>>> db = DriverManager.getConnection("jdbc:postgresql://hostname/" + dbName,"bruger","kode");
>>>>>> } catch (SQLException e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>> On my system I have putted the jdbc driver for postgres into the classpath:
>>>>>> hostname:~$ echo $CLASSPATH
>>>>>> /usr/share/java/pg74.216.jdbc3.jar
>>>>>> Java version:
>>>>>> hostname:~$ java -version
>>>>>> java version "1.5.0_06"
>>>>>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
>>>>>> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
>>>>>> As far as I know it should work since, it is correct in the classpath. I have also tried with other postgres jdbc drivers. In my IDE(Eclipse), it works fine, but on my production server it gives the error.
>>>>>> I've also tried to run the program with the -classpath flag, with the same result.
>>>>>> Have I simply forgotten something, or is there something seriously wrong?
>>>>>> Thanks in advance.
>>>>>
>>>>
>>>
>>
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-28 09:11 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
@ 2006-04-28 10:03 ` Oliver Jowett <oliver@opencloud.com>
2006-04-28 10:06 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
0 siblings, 1 reply; 17+ messages in thread
From: Oliver Jowett @ 2006-04-28 10:03 UTC (permalink / raw)
To: Mads N. Vestergaard <mnv@timmy.dk>; +Cc: pgsql-jdbc
Mads N. Vestergaard wrote:
> hostname:~$ java -verbose -cp /usr/share/java/pg74.216.jdbc3.jar -jar
> program.jar
>
-jar causes the JVM to completely ignore any additional classpath you
specify.
Instead, try:
java -cp /usr/share/java/pg74.216.jdbc3.jar:program.jar ProgramMainClass
-O
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-28 09:11 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:03 ` Re: java.sql.SQLException: No suitable driver Oliver Jowett <oliver@opencloud.com>
@ 2006-04-28 10:06 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:24 ` Re: java.sql.SQLException: No suitable driver Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 17+ messages in thread
From: Mads N. Vestergaard @ 2006-04-28 10:06 UTC (permalink / raw)
To: pgsql-jdbc
Hi Aliver,
there isn't any conditional files in the environment variable CLASSPATH,
and the program runs fine, it just can't connect to the database.
Oliver Jowett wrote:
> Mads N. Vestergaard wrote:
>
>> hostname:~$ java -verbose -cp /usr/share/java/pg74.216.jdbc3.jar -jar
>> program.jar
>>
>
> -jar causes the JVM to completely ignore any additional classpath you
> specify.
>
> Instead, try:
>
> java -cp /usr/share/java/pg74.216.jdbc3.jar:program.jar ProgramMainClass
>
> -O
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-28 09:11 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:03 ` Re: java.sql.SQLException: No suitable driver Oliver Jowett <oliver@opencloud.com>
2006-04-28 10:06 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
@ 2006-04-28 10:24 ` Oliver Jowett <oliver@opencloud.com>
2006-04-28 11:04 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
0 siblings, 1 reply; 17+ messages in thread
From: Oliver Jowett @ 2006-04-28 10:24 UTC (permalink / raw)
To: Mads N. Vestergaard <mnv@timmy.dk>; +Cc: pgsql-jdbc
Mads N. Vestergaard wrote:
> Hi Aliver,
>
> there isn't any conditional files in the environment variable CLASSPATH,
> and the program runs fine, it just can't connect to the database.
I am talking about both the CLASSPATH environment variable and the -cp
command line argument. In my experience, if you specify -jar, both are
ignored and classes are only loaded from the standard locations, and the
single jarfile parameter given to -jar ("program.jar" in your case).
Have you tried the command line I suggested?
>> java -cp /usr/share/java/pg74.216.jdbc3.jar:program.jar ProgramMainClass
Please try this and let us know if it works.
I would also suggest that silently ignoring ClassNotFoundException, as
the code you originally posted does, is a Really Bad Idea. That code is
masking the real source of the error: namely, that the driver classes
are *not* in your classpath.
-O
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: java.sql.SQLException: No suitable driver
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Re: java.sql.SQLException: No suitable driver Dave Cramer <pg@fastcrypt.com>
2006-04-28 09:11 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:03 ` Re: java.sql.SQLException: No suitable driver Oliver Jowett <oliver@opencloud.com>
2006-04-28 10:06 ` Re: java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:24 ` Re: java.sql.SQLException: No suitable driver Oliver Jowett <oliver@opencloud.com>
@ 2006-04-28 11:04 ` Mads N. Vestergaard <mnv@timmy.dk>
0 siblings, 0 replies; 17+ messages in thread
From: Mads N. Vestergaard @ 2006-04-28 11:04 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>
Hi Oliver...
That seems to work just perfectly....
Oliver Jowett wrote:
> Mads N. Vestergaard wrote:
>> Hi Aliver,
>>
>> there isn't any conditional files in the environment variable CLASSPATH,
>> and the program runs fine, it just can't connect to the database.
>
> I am talking about both the CLASSPATH environment variable and the -cp
> command line argument. In my experience, if you specify -jar, both are
> ignored and classes are only loaded from the standard locations, and
> the single jarfile parameter given to -jar ("program.jar" in your case).
>
> Have you tried the command line I suggested?
>
>>> java -cp /usr/share/java/pg74.216.jdbc3.jar:program.jar
>>> ProgramMainClass
>
> Please try this and let us know if it works.
>
> I would also suggest that silently ignoring ClassNotFoundException, as
> the code you originally posted does, is a Really Bad Idea. That code
> is masking the real source of the error: namely, that the driver
> classes are *not* in your classpath.
>
> -O
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
^ permalink raw reply [nested|flat] 17+ messages in thread
end of thread, other threads:[~2006-04-28 11:04 UTC | newest]
Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-10 17:24 java.sql.SQLException: No suitable driver boleguy@adinet.com.uy
2005-05-10 17:32 ` Nelson Arapé <narape@ica.luz.ve>
2005-05-10 17:38 ` Franco Bruno Borghesi <fborghesi@gmail.com>
2006-03-10 07:44 java.sql.SQLException: No suitable driver Yunush Mulla <mullayunush@yahoo.co.in>
2006-03-10 07:48 ` Brendan Duddridge <brendan@clickspace.com>
2006-03-10 19:25 ` Kris Jurka <books@ejurka.com>
2006-04-27 12:19 java.sql.SQLException: No suitable driver Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:25 ` Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:31 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:43 ` Dave Cramer <pg@fastcrypt.com>
2006-04-27 13:46 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-27 13:56 ` Dave Cramer <pg@fastcrypt.com>
2006-04-28 09:11 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:03 ` Oliver Jowett <oliver@opencloud.com>
2006-04-28 10:06 ` Mads N. Vestergaard <mnv@timmy.dk>
2006-04-28 10:24 ` Oliver Jowett <oliver@opencloud.com>
2006-04-28 11:04 ` Mads N. Vestergaard <mnv@timmy.dk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox