Обсуждение: Connection Problem with JDBC

Поиск
Список
Период
Сортировка

Connection Problem with JDBC

От
"Steven Murphy"
Дата:
Hi,

I'm trying to connect to a PostgreSQL database using JDBC but when I run the
program I get an error message saying "No suitable driver".

I'm using PostgreSQL 7.1.3 and java 1.3.1_01.

I have added the jdbc7.1-1.2.jar file to the CLASSPATH.

The command I am using to run the program is
java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
jdbc:postgresql:javatest postgres ' '

The program I'm trying to use is :-

import java.sql.*;

public class ConnectDemo {

  public static void main(String[] argv) {
      // No need to register the driver, since the user
      // used -Djdbc.drivers to set it.

      // Check the arguments.
      //
      if (argv.length < 3) {
          usage();
      }
      String url  = argv[0];
      String user = argv[1];
      String pass = argv[2];

      // Invoke getConnection() to create the
      // connection object.
      //
      Connection conn;
      try {
          conn = DriverManager.getConnection(url, user, pass);
          System.out.println("Connection successful.");
          System.out.println("Connection as String: " + conn);
      } catch (SQLException e) {
          System.err.println( e.getMessage() );
          System.exit(-1);
      }
  }

  static void usage() {
      System.err.println("Usage:");
      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
      System.err.println("URL USER PASS");
      System.exit(-1);

  }
}

I would be greatful for any help as I trying to do this for my final year
project at University and the deadline is fast approaching.

Cheers
Steven Murphy.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Re: Connection Problem with JDBC

От
"Dave Cramer"
Дата:
Steven,

Well, you've got me beat. I just tried your code and it works as
advertised in Jbuilder, but from the command line it doesn't load the
driver?

If I were you, I would just load the driver in your main.

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Steven Murphy
Sent: Monday, February 11, 2002 10:09 AM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Connection Problem with JDBC


Hi,

I'm trying to connect to a PostgreSQL database using JDBC but when I run
the
program I get an error message saying "No suitable driver".

I'm using PostgreSQL 7.1.3 and java 1.3.1_01.

I have added the jdbc7.1-1.2.jar file to the CLASSPATH.

The command I am using to run the program is
java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
jdbc:postgresql:javatest postgres ' '

The program I'm trying to use is :-

import java.sql.*;

public class ConnectDemo {

  public static void main(String[] argv) {
      // No need to register the driver, since the user
      // used -Djdbc.drivers to set it.

      // Check the arguments.
      //
      if (argv.length < 3) {
          usage();
      }
      String url  = argv[0];
      String user = argv[1];
      String pass = argv[2];

      // Invoke getConnection() to create the
      // connection object.
      //
      Connection conn;
      try {
          conn = DriverManager.getConnection(url, user, pass);
          System.out.println("Connection successful.");
          System.out.println("Connection as String: " + conn);
      } catch (SQLException e) {
          System.err.println( e.getMessage() );
          System.exit(-1);
      }
  }

  static void usage() {
      System.err.println("Usage:");
      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
      System.err.println("URL USER PASS");
      System.exit(-1);

  }
}

I would be greatful for any help as I trying to do this for my final
year
project at University and the deadline is fast approaching.

Cheers
Steven Murphy.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: Connection Problem with JDBC

От
Barry Lind
Дата:
Steven,

This works for me.

[blind@barry work]$ echo $CLASSPATH
.:/home/blind/work/wfs/jars/postgresjdbc.jar
[blind@barry work]$ java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo jdbc:postgresql://localhost:5432/files blind ""
Connection successful.
Connection as String: org.postgresql.jdbc2.Connection@4ac268

I am running on RedHat 7.2, jdk 1.3.1_01 with the postgres 7.2 jdbc drivers.

Are you sure that the jdbc jar file is in your CLASSPATH, and that you
have exported the CLASSPATH setting back to the environment?

thanks,
--Barry



Steven Murphy wrote:
> Hi,
>
> I'm trying to connect to a PostgreSQL database using JDBC but when I run
> the program I get an error message saying "No suitable driver".
>
> I'm using PostgreSQL 7.1.3 and java 1.3.1_01.
>
> I have added the jdbc7.1-1.2.jar file to the CLASSPATH.
>
> The command I am using to run the program is
> java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
> jdbc:postgresql:javatest postgres ' '
>
> The program I'm trying to use is :-
>
> import java.sql.*;
>
> public class ConnectDemo {
>
>  public static void main(String[] argv) {
>      // No need to register the driver, since the user
>      // used -Djdbc.drivers to set it.
>
>      // Check the arguments.
>      //
>      if (argv.length < 3) {
>          usage();
>      }
>      String url  = argv[0];
>      String user = argv[1];
>      String pass = argv[2];
>
>      // Invoke getConnection() to create the
>      // connection object.
>      //
>      Connection conn;
>      try {
>          conn = DriverManager.getConnection(url, user, pass);
>          System.out.println("Connection successful.");
>          System.out.println("Connection as String: " + conn);
>      } catch (SQLException e) {
>          System.err.println( e.getMessage() );
>          System.exit(-1);
>      }
>  }
>
>  static void usage() {
>      System.err.println("Usage:");
>      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
>      System.err.println("URL USER PASS");
>      System.exit(-1);
>
>  }
> }
>
> I would be greatful for any help as I trying to do this for my final
> year project at University and the deadline is fast approaching.
>
> Cheers
> Steven Murphy.
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>



Re: Connection Problem with JDBC

От
"Dave Cramer"
Дата:
I just verified that it works under linux as advertised, but still
doesn't work under windoze. Steven, I presume you are trying to use this
on a windows machine?

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Barry Lind
Sent: Monday, February 11, 2002 12:46 PM
To: Steven Murphy
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


Steven,

This works for me.

[blind@barry work]$ echo $CLASSPATH
.:/home/blind/work/wfs/jars/postgresjdbc.jar
[blind@barry work]$ java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo jdbc:postgresql://localhost:5432/files blind "" Connection
successful. Connection as String: org.postgresql.jdbc2.Connection@4ac268

I am running on RedHat 7.2, jdk 1.3.1_01 with the postgres 7.2 jdbc
drivers.

Are you sure that the jdbc jar file is in your CLASSPATH, and that you
have exported the CLASSPATH setting back to the environment?

thanks,
--Barry



Steven Murphy wrote:
> Hi,
>
> I'm trying to connect to a PostgreSQL database using JDBC but when I
> run
> the program I get an error message saying "No suitable driver".
>
> I'm using PostgreSQL 7.1.3 and java 1.3.1_01.
>
> I have added the jdbc7.1-1.2.jar file to the CLASSPATH.
>
> The command I am using to run the program is
> java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
> jdbc:postgresql:javatest postgres ' '
>
> The program I'm trying to use is :-
>
> import java.sql.*;
>
> public class ConnectDemo {
>
>  public static void main(String[] argv) {
>      // No need to register the driver, since the user
>      // used -Djdbc.drivers to set it.
>
>      // Check the arguments.
>      //
>      if (argv.length < 3) {
>          usage();
>      }
>      String url  = argv[0];
>      String user = argv[1];
>      String pass = argv[2];
>
>      // Invoke getConnection() to create the
>      // connection object.
>      //
>      Connection conn;
>      try {
>          conn = DriverManager.getConnection(url, user, pass);
>          System.out.println("Connection successful.");
>          System.out.println("Connection as String: " + conn);
>      } catch (SQLException e) {
>          System.err.println( e.getMessage() );
>          System.exit(-1);
>      }
>  }
>
>  static void usage() {
>      System.err.println("Usage:");
>      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
>      System.err.println("URL USER PASS");
>      System.exit(-1);
>
>  }
> }
>
> I would be greatful for any help as I trying to do this for my final
> year project at University and the deadline is fast approaching.
>
> Cheers
> Steven Murphy.
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



Re: Connection Problem with JDBC

От
"Steven Murphy"
Дата:
No I'm using Red Hat Linux 7.1

Steve.


From: "Dave Cramer" <Dave@micro-automation.net>
Reply-To: <Dave@micro-automation.net>
To: "'Barry Lind'" <barry@xythos.com>, "'Steven Murphy'"
<stevenmurphy@hotmail.com>
CC: <pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection Problem with JDBC
Date: Mon, 11 Feb 2002 13:27:18 -0500

I just verified that it works under linux as advertised, but still
doesn't work under windoze. Steven, I presume you are trying to use this
on a windows machine?

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Barry Lind
Sent: Monday, February 11, 2002 12:46 PM
To: Steven Murphy
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


Steven,

This works for me.

[blind@barry work]$ echo $CLASSPATH
.:/home/blind/work/wfs/jars/postgresjdbc.jar
[blind@barry work]$ java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo jdbc:postgresql://localhost:5432/files blind "" Connection
successful. Connection as String: org.postgresql.jdbc2.Connection@4ac268

I am running on RedHat 7.2, jdk 1.3.1_01 with the postgres 7.2 jdbc
drivers.

Are you sure that the jdbc jar file is in your CLASSPATH, and that you
have exported the CLASSPATH setting back to the environment?

thanks,
--Barry



Steven Murphy wrote:
 > Hi,
 >
 > I'm trying to connect to a PostgreSQL database using JDBC but when I
 > run
 > the program I get an error message saying "No suitable driver".
 >
 > I'm using PostgreSQL 7.1.3 and java 1.3.1_01.
 >
 > I have added the jdbc7.1-1.2.jar file to the CLASSPATH.
 >
 > The command I am using to run the program is
 > java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
 > jdbc:postgresql:javatest postgres ' '
 >
 > The program I'm trying to use is :-
 >
 > import java.sql.*;
 >
 > public class ConnectDemo {
 >
 >  public static void main(String[] argv) {
 >      // No need to register the driver, since the user
 >      // used -Djdbc.drivers to set it.
 >
 >      // Check the arguments.
 >      //
 >      if (argv.length < 3) {
 >          usage();
 >      }
 >      String url  = argv[0];
 >      String user = argv[1];
 >      String pass = argv[2];
 >
 >      // Invoke getConnection() to create the
 >      // connection object.
 >      //
 >      Connection conn;
 >      try {
 >          conn = DriverManager.getConnection(url, user, pass);
 >          System.out.println("Connection successful.");
 >          System.out.println("Connection as String: " + conn);
 >      } catch (SQLException e) {
 >          System.err.println( e.getMessage() );
 >          System.exit(-1);
 >      }
 >  }
 >
 >  static void usage() {
 >      System.err.println("Usage:");
 >      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
 >      System.err.println("URL USER PASS");
 >      System.exit(-1);
 >
 >  }
 > }
 >
 > I would be greatful for any help as I trying to do this for my final
 > year project at University and the deadline is fast approaching.
 >
 > Cheers
 > Steven Murphy.
 >
 > _________________________________________________________________
 > Send and receive Hotmail on your mobile device: http://mobile.msn.com
 >
 >
 > ---------------------------(end of
 > broadcast)---------------------------
 > TIP 5: Have you checked our extensive FAQ?
 >
 > http://www.postgresql.org/users-lounge/docs/faq.html
 >



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)






"The only Black magic Sabbath ever got into was a box of chocolates" - Ozzy
Osbourne


_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


Re: Connection Problem with JDBC

От
"Nick Fankhauser"
Дата:
> The command I am using to run the program is
> java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
> jdbc:postgresql:javatest postgres ' '

I think if it was a classpath problem, you'd be getting a
"ClassNotFoundException" I believe the "No Suitable Driver" indicates that
among the drivers you have loaded, none matches the database url passed to
DriverManager.getConnection. ...But the command & url above look just fine &
I can't see any opportunity in your program for the url to get mangled.

Have you tried loading the drivers using Class.forName in main? I'm not sure
what it would tell us if it worked, but if it didn't work that way, I think
I'd download the driver again.

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/



Re: Connection Problem with JDBC

От
"Dave Cramer"
Дата:
Steve,

What do you get when you add the following code

Enumeration e = DriverManager.getDrivers();
While(e.hasNext()){
    System.out.println(e.nextElement());
}

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Steven Murphy
Sent: Monday, February 11, 2002 3:13 PM
To: Dave@micro-automation.net; barry@xythos.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


No I'm using Red Hat Linux 7.1

Steve.


From: "Dave Cramer" <Dave@micro-automation.net>
Reply-To: <Dave@micro-automation.net>
To: "'Barry Lind'" <barry@xythos.com>, "'Steven Murphy'"
<stevenmurphy@hotmail.com>
CC: <pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection Problem with JDBC
Date: Mon, 11 Feb 2002 13:27:18 -0500

I just verified that it works under linux as advertised, but still
doesn't work under windoze. Steven, I presume you are trying to use this
on a windows machine?

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Barry Lind
Sent: Monday, February 11, 2002 12:46 PM
To: Steven Murphy
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


Steven,

This works for me.

[blind@barry work]$ echo $CLASSPATH
.:/home/blind/work/wfs/jars/postgresjdbc.jar
[blind@barry work]$ java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo jdbc:postgresql://localhost:5432/files blind "" Connection
successful. Connection as String: org.postgresql.jdbc2.Connection@4ac268

I am running on RedHat 7.2, jdk 1.3.1_01 with the postgres 7.2 jdbc
drivers.

Are you sure that the jdbc jar file is in your CLASSPATH, and that you
have exported the CLASSPATH setting back to the environment?

thanks,
--Barry



Steven Murphy wrote:
 > Hi,
 >
 > I'm trying to connect to a PostgreSQL database using JDBC but when I
> run  > the program I get an error message saying "No suitable driver".
>  > I'm using PostgreSQL 7.1.3 and java 1.3.1_01.  >  > I have added
the jdbc7.1-1.2.jar file to the CLASSPATH.  >  > The command I am using
to run the program is  > java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo  > jdbc:postgresql:javatest postgres ' '  >  > The program
I'm trying to use is :-  >  > import java.sql.*;  >  > public class
ConnectDemo {  >  >  public static void main(String[] argv) {
 >      // No need to register the driver, since the user
 >      // used -Djdbc.drivers to set it.
 >
 >      // Check the arguments.
 >      //
 >      if (argv.length < 3) {
 >          usage();
 >      }
 >      String url  = argv[0];
 >      String user = argv[1];
 >      String pass = argv[2];
 >
 >      // Invoke getConnection() to create the
 >      // connection object.
 >      //
 >      Connection conn;
 >      try {
 >          conn = DriverManager.getConnection(url, user, pass);
 >          System.out.println("Connection successful.");
 >          System.out.println("Connection as String: " + conn);
 >      } catch (SQLException e) {
 >          System.err.println( e.getMessage() );
 >          System.exit(-1);
 >      }
 >  }
 >
 >  static void usage() {
 >      System.err.println("Usage:");
 >      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
 >      System.err.println("URL USER PASS");
 >      System.exit(-1);
 >
 >  }
 > }
 >
 > I would be greatful for any help as I trying to do this for my final
> year project at University and the deadline is fast approaching.  >  >
Cheers  > Steven Murphy.  >  >
_________________________________________________________________
 > Send and receive Hotmail on your mobile device: http://mobile.msn.com
>  >  > ---------------------------(end of  >
broadcast)---------------------------
 > TIP 5: Have you checked our extensive FAQ?
 >
 > http://www.postgresql.org/users-lounge/docs/faq.html
 >



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
     (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)






"The only Black magic Sabbath ever got into was a box of chocolates" -
Ozzy
Osbourne


_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: Connection Problem with JDBC

От
"Nick Fankhauser"
Дата:
In the place where you catch the SQL exception, you just need to add a
couple more exception handlers, so it would look like this:

      } catch (SQLException se) {
          System.err.println( se.getMessage() );
      } catch (ClassNotFoundException cnfe) {
          System.err.println( cnfe.getMessage() );
      } catch (InstantiationException ie) {
          System.err.println( ie.getMessage() );

Then try to compile again.

-NickF

> -----Original Message-----
> From: Steven Murphy [mailto:stevenmurphy@hotmail.com]
> Sent: Monday, February 25, 2002 9:02 AM
> To: nickf@ontko.com; pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] Connection Problem with JDBC
>
>
> Hi all,
>
> I have added the code to load the drivers using Class.forName in
> main, but
> when I compile the code I get the following errors :-
>
> ConnectDemo.java:27: unreported exception
> java.lang.ClassNotFoundException;
> must be caught or declared to be thrown
>             Class.forName("org.postgresql.Driver").newInstance();
>                      ^
> ConnectDemo.java:27: unreported exception
> java.lang.InstantiationException;
> must be caught or declared to be thrown
>             Class.forName("org.postgresql.Driver").newInstance();
>                              ^
> 2 errors
>
> Here is how the program looks now I have added the Class.forName bit :-
>
> // Import the JDBC classes.
> //
> import java.sql.*;
>
> public class ConnectDemo {
>
>   public static void main(String[] argv) {
>
>       if (argv.length < 3) {
>           usage();
>       }
>       String url  = argv[0];
>       String user = argv[1];
>       String pass = argv[2];
>
>       // Invoke getConnection() to create the
>       // connection object.
>       //
>       Connection conn;
>       try {
>             Driver driver = (Driver)
>                 Class.forName("org.postgresql.Driver").newInstance();
>             DriverManager.registerDriver(driver);
>           conn = DriverManager.getConnection(url, user, pass);
>           System.out.println("Connection successful.");
>           System.out.println("Connection as String: " + conn);
>       } catch (SQLException e) {
>           System.err.println( e.getMessage() );
>           System.exit(-1);
>       }
>
>   }
>
>   static void usage() {
>
>       System.err.println("Usage:");
>       System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
>       System.err.println("URL USER PASS");
>       System.exit(-1);
>
>   }
>
> Do I need to import some other things to get this to work?
> Sorry I'm a bit of a novice with all of this.
>
> Cheers
> Steve.
>
> --------------------------------------------------------------------
>
> From: "Nick Fankhauser" <nickf@ontko.com>
> Reply-To: <nickf@ontko.com>
> To: "Steven Murphy" <stevenmurphy@hotmail.com>,
> <pgsql-jdbc@postgresql.org>
> Subject: Re: [JDBC] Connection Problem with JDBC
> Date: Mon, 11 Feb 2002 15:44:04 -0500
>
>  > The command I am using to run the program is
>  > java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
>  > jdbc:postgresql:javatest postgres ' '
>
> I think if it was a classpath problem, you'd be getting a
> "ClassNotFoundException" I believe the "No Suitable Driver"
> indicates that
> among the drivers you have loaded, none matches the database url
> passed to
> DriverManager.getConnection. ...But the command & url above look
> just fine &
> I can't see any opportunity in your program for the url to get mangled.
>
> Have you tried loading the drivers using Class.forName in main?
> I'm not sure
> what it would tell us if it worked, but if it didn't work that
> way, I think
> I'd download the driver again.
>
> -Nick
>
> --------------------------------------------------------------------------
> Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
> Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>      (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>


Re: Connection Problem with JDBC

От
"Steven Murphy"
Дата:
Dave,

Where abouts would I put this code?  I tried just adding it to the bottom of
the program but when I compiled I got some error messages.

Cheers
Steve.

From: "Dave Cramer" <Dave@micro-automation.net>
Reply-To: <Dave@micro-automation.net>
To: "'Steven Murphy'" <stevenmurphy@hotmail.com>, <barry@xythos.com>
CC: <pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection Problem with JDBC
Date: Tue, 12 Feb 2002 09:32:54 -0500

Steve,

What do you get when you add the following code

Enumeration e = DriverManager.getDrivers();
While(e.hasNext()){
    System.out.println(e.nextElement());
}

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Steven Murphy
Sent: Monday, February 11, 2002 3:13 PM
To: Dave@micro-automation.net; barry@xythos.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


No I'm using Red Hat Linux 7.1

Steve.


From: "Dave Cramer" <Dave@micro-automation.net>
Reply-To: <Dave@micro-automation.net>
To: "'Barry Lind'" <barry@xythos.com>, "'Steven Murphy'"
<stevenmurphy@hotmail.com>
CC: <pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection Problem with JDBC
Date: Mon, 11 Feb 2002 13:27:18 -0500

I just verified that it works under linux as advertised, but still
doesn't work under windoze. Steven, I presume you are trying to use this
on a windows machine?

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Barry Lind
Sent: Monday, February 11, 2002 12:46 PM
To: Steven Murphy
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


Steven,

This works for me.

[blind@barry work]$ echo $CLASSPATH
.:/home/blind/work/wfs/jars/postgresjdbc.jar
[blind@barry work]$ java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo jdbc:postgresql://localhost:5432/files blind "" Connection
successful. Connection as String: org.postgresql.jdbc2.Connection@4ac268

I am running on RedHat 7.2, jdk 1.3.1_01 with the postgres 7.2 jdbc
drivers.

Are you sure that the jdbc jar file is in your CLASSPATH, and that you
have exported the CLASSPATH setting back to the environment?

thanks,
--Barry



Steven Murphy wrote:
  > Hi,
  >
  > I'm trying to connect to a PostgreSQL database using JDBC but when I
 > run  > the program I get an error message saying "No suitable driver".
 >  > I'm using PostgreSQL 7.1.3 and java 1.3.1_01.  >  > I have added
the jdbc7.1-1.2.jar file to the CLASSPATH.  >  > The command I am using
to run the program is  > java -Djdbc.drivers=org.postgresql.Driver
ConnectDemo  > jdbc:postgresql:javatest postgres ' '  >  > The program
I'm trying to use is :-  >  > import java.sql.*;  >  > public class
ConnectDemo {  >  >  public static void main(String[] argv) {
  >      // No need to register the driver, since the user
  >      // used -Djdbc.drivers to set it.
  >
  >      // Check the arguments.
  >      //
  >      if (argv.length < 3) {
  >          usage();
  >      }
  >      String url  = argv[0];
  >      String user = argv[1];
  >      String pass = argv[2];
  >
  >      // Invoke getConnection() to create the
  >      // connection object.
  >      //
  >      Connection conn;
  >      try {
  >          conn = DriverManager.getConnection(url, user, pass);
  >          System.out.println("Connection successful.");
  >          System.out.println("Connection as String: " + conn);
  >      } catch (SQLException e) {
  >          System.err.println( e.getMessage() );
  >          System.exit(-1);
  >      }
  >  }
  >
  >  static void usage() {
  >      System.err.println("Usage:");
  >      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
  >      System.err.println("URL USER PASS");
  >      System.exit(-1);
  >
  >  }
  > }
  >
  > I would be greatful for any help as I trying to do this for my final
 > year project at University and the deadline is fast approaching.  >  >
Cheers  > Steven Murphy.  >  >
_________________________________________________________________
  > Send and receive Hotmail on your mobile device: http://mobile.msn.com
 >  >  > ---------------------------(end of  >
broadcast)---------------------------
  > TIP 5: Have you checked our extensive FAQ?
  >
  > http://www.postgresql.org/users-lounge/docs/faq.html
  >



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
      (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


Re: Connection Problem with JDBC

От
"Steven Murphy"
Дата:
Hi all,

I have added the code to load the drivers using Class.forName in main, but
when I compile the code I get the following errors :-

ConnectDemo.java:27: unreported exception java.lang.ClassNotFoundException;
must be caught or declared to be thrown
            Class.forName("org.postgresql.Driver").newInstance();
                     ^
ConnectDemo.java:27: unreported exception java.lang.InstantiationException;
must be caught or declared to be thrown
            Class.forName("org.postgresql.Driver").newInstance();
                             ^
2 errors

Here is how the program looks now I have added the Class.forName bit :-

// Import the JDBC classes.
//
import java.sql.*;

public class ConnectDemo {

  public static void main(String[] argv) {

      if (argv.length < 3) {
          usage();
      }
      String url  = argv[0];
      String user = argv[1];
      String pass = argv[2];

      // Invoke getConnection() to create the
      // connection object.
      //
      Connection conn;
      try {
            Driver driver = (Driver)
                Class.forName("org.postgresql.Driver").newInstance();
            DriverManager.registerDriver(driver);
          conn = DriverManager.getConnection(url, user, pass);
          System.out.println("Connection successful.");
          System.out.println("Connection as String: " + conn);
      } catch (SQLException e) {
          System.err.println( e.getMessage() );
          System.exit(-1);
      }

  }

  static void usage() {

      System.err.println("Usage:");
      System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
      System.err.println("URL USER PASS");
      System.exit(-1);

  }

Do I need to import some other things to get this to work?
Sorry I'm a bit of a novice with all of this.

Cheers
Steve.

--------------------------------------------------------------------

From: "Nick Fankhauser" <nickf@ontko.com>
Reply-To: <nickf@ontko.com>
To: "Steven Murphy" <stevenmurphy@hotmail.com>, <pgsql-jdbc@postgresql.org>
Subject: Re: [JDBC] Connection Problem with JDBC
Date: Mon, 11 Feb 2002 15:44:04 -0500

 > The command I am using to run the program is
 > java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
 > jdbc:postgresql:javatest postgres ' '

I think if it was a classpath problem, you'd be getting a
"ClassNotFoundException" I believe the "No Suitable Driver" indicates that
among the drivers you have loaded, none matches the database url passed to
DriverManager.getConnection. ...But the command & url above look just fine &
I can't see any opportunity in your program for the url to get mangled.

Have you tried loading the drivers using Class.forName in main? I'm not sure
what it would tell us if it worked, but if it didn't work that way, I think
I'd download the driver again.

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


Re: Connection Problem with JDBC

От
"Steven Murphy"
Дата:
I have added the extra handlers to the catch SQL exception part of the code,
but when I compiled the program I got the following error :-

ConnectDemo.java:19: unreported exception java.lang.IllegalAccessException;
must be caught or declared to be thrown
            Class.forName("org.postgresql.Driver").newInstance();
                             ^
1 error

Below is the code that I added :-

       } catch (SQLException se) {
          System.err.println( se.getMessage() );
       } catch (ClassNotFoundException cnfe) {
          System.err.println( cnfe.getMessage() );
       } catch (InstantiationException ie) {
          System.err.println( ie.getMessage() );
          System.exit(-1);
       }

Do you know what might be causing this error?

Cheers
Steve.

---------------------------------------------------------------

From: "Nick Fankhauser" <nickf@ontko.com>
Reply-To: <nickf@ontko.com>
To: "Steven Murphy" <stevenmurphy@hotmail.com>, <pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection Problem with JDBC
Date: Mon, 25 Feb 2002 09:04:22 -0500


In the place where you catch the SQL exception, you just need to add a
couple more exception handlers, so it would look like this:

       } catch (SQLException se) {
           System.err.println( se.getMessage() );
       } catch (ClassNotFoundException cnfe) {
           System.err.println( cnfe.getMessage() );
       } catch (InstantiationException ie) {
           System.err.println( ie.getMessage() );

Then try to compile again.

-NickF

 > -----Original Message-----
 > From: Steven Murphy [mailto:stevenmurphy@hotmail.com]
 > Sent: Monday, February 25, 2002 9:02 AM
 > To: nickf@ontko.com; pgsql-jdbc@postgresql.org
 > Subject: Re: [JDBC] Connection Problem with JDBC
 >
 >
 > Hi all,
 >
 > I have added the code to load the drivers using Class.forName in
 > main, but
 > when I compile the code I get the following errors :-
 >
 > ConnectDemo.java:27: unreported exception
 > java.lang.ClassNotFoundException;
 > must be caught or declared to be thrown
 >             Class.forName("org.postgresql.Driver").newInstance();
 >                      ^
 > ConnectDemo.java:27: unreported exception
 > java.lang.InstantiationException;
 > must be caught or declared to be thrown
 >             Class.forName("org.postgresql.Driver").newInstance();
 >                              ^
 > 2 errors
 >
 > Here is how the program looks now I have added the Class.forName bit :-
 >
 > // Import the JDBC classes.
 > //
 > import java.sql.*;
 >
 > public class ConnectDemo {
 >
 >   public static void main(String[] argv) {
 >
 >       if (argv.length < 3) {
 >           usage();
 >       }
 >       String url  = argv[0];
 >       String user = argv[1];
 >       String pass = argv[2];
 >
 >       // Invoke getConnection() to create the
 >       // connection object.
 >       //
 >       Connection conn;
 >       try {
 >             Driver driver = (Driver)
 >                 Class.forName("org.postgresql.Driver").newInstance();
 >             DriverManager.registerDriver(driver);
 >           conn = DriverManager.getConnection(url, user, pass);
 >           System.out.println("Connection successful.");
 >           System.out.println("Connection as String: " + conn);
 >       } catch (SQLException e) {
 >           System.err.println( e.getMessage() );
 >           System.exit(-1);
 >       }
 >
 >   }
 >
 >   static void usage() {
 >
 >       System.err.println("Usage:");
 >       System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
 >       System.err.println("URL USER PASS");
 >       System.exit(-1);
 >
 >   }
 >
 > Do I need to import some other things to get this to work?
 > Sorry I'm a bit of a novice with all of this.
 >
 > Cheers
 > Steve.
 >
 > --------------------------------------------------------------------
 >
 > From: "Nick Fankhauser" <nickf@ontko.com>
 > Reply-To: <nickf@ontko.com>
 > To: "Steven Murphy" <stevenmurphy@hotmail.com>,
 > <pgsql-jdbc@postgresql.org>
 > Subject: Re: [JDBC] Connection Problem with JDBC
 > Date: Mon, 11 Feb 2002 15:44:04 -0500
 >
 >  > The command I am using to run the program is
 >  > java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
 >  > jdbc:postgresql:javatest postgres ' '
 >
 > I think if it was a classpath problem, you'd be getting a
 > "ClassNotFoundException" I believe the "No Suitable Driver"
 > indicates that
 > among the drivers you have loaded, none matches the database url
 > passed to
 > DriverManager.getConnection. ...But the command & url above look
 > just fine &
 > I can't see any opportunity in your program for the url to get mangled.
 >
 > Have you tried loading the drivers using Class.forName in main?
 > I'm not sure
 > what it would tell us if it worked, but if it didn't work that
 > way, I think
 > I'd download the driver again.
 >
 > -Nick
 >
 >
--------------------------------------------------------------------------
 > Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax
1.765.962.9788
 > Ray Ontko & Co.     Software Consulting Services
http://www.ontko.com/
 >
 > ---------------------------(end of broadcast)---------------------------
 > TIP 2: you can get off all lists at once with the unregister command
 >      (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
 >
 > _________________________________________________________________
 > MSN Photos is the easiest way to share and print your photos:
 > http://photos.msn.com/support/worldwide.aspx
 >





"The only Black magic Sabbath ever got into was a box of chocolates" - Ozzy
Osbourne


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


Re: Connection Problem with JDBC

От
"Nick Fankhauser"
Дата:
I'm sorry- I didn't look closely enough at the code you placed in your
original post. (I should have wondered why there were so many exceptions to
catch.)

I'd suggest replacing this chunk of code:

            Driver driver = (Driver)
                Class.forName("org.postgresql.Driver").newInstance();
            DriverManager.registerDriver(driver);

with this:

            Class.forName("org.postgresql.Driver");


Then you can also eliminate the two exception handlers that you just added.

I think all of the other code that you have in that section is only
necessary if you're loading the driver after passing it as a parameter to
the jvm.

-NickF





> -----Original Message-----
> From: Steven Murphy [mailto:stevenmurphy@hotmail.com]
> Sent: Monday, February 25, 2002 9:58 AM
> To: nickf@ontko.com; pgsql-jdbc@postgresql.org
> Subject: RE: [JDBC] Connection Problem with JDBC
>
>
> I have added the extra handlers to the catch SQL exception part
> of the code,
> but when I compiled the program I got the following error :-
>
> ConnectDemo.java:19: unreported exception
> java.lang.IllegalAccessException;
> must be caught or declared to be thrown
>             Class.forName("org.postgresql.Driver").newInstance();
>                              ^
> 1 error
>
> Below is the code that I added :-
>
>        } catch (SQLException se) {
>           System.err.println( se.getMessage() );
>        } catch (ClassNotFoundException cnfe) {
>           System.err.println( cnfe.getMessage() );
>        } catch (InstantiationException ie) {
>           System.err.println( ie.getMessage() );
>           System.exit(-1);
>        }
>
> Do you know what might be causing this error?
>
> Cheers
> Steve.
>
> ---------------------------------------------------------------
>
> From: "Nick Fankhauser" <nickf@ontko.com>
> Reply-To: <nickf@ontko.com>
> To: "Steven Murphy" <stevenmurphy@hotmail.com>,
> <pgsql-jdbc@postgresql.org>
> Subject: RE: [JDBC] Connection Problem with JDBC
> Date: Mon, 25 Feb 2002 09:04:22 -0500
>
>
> In the place where you catch the SQL exception, you just need to add a
> couple more exception handlers, so it would look like this:
>
>        } catch (SQLException se) {
>            System.err.println( se.getMessage() );
>        } catch (ClassNotFoundException cnfe) {
>            System.err.println( cnfe.getMessage() );
>        } catch (InstantiationException ie) {
>            System.err.println( ie.getMessage() );
>
> Then try to compile again.
>
> -NickF
>
>  > -----Original Message-----
>  > From: Steven Murphy [mailto:stevenmurphy@hotmail.com]
>  > Sent: Monday, February 25, 2002 9:02 AM
>  > To: nickf@ontko.com; pgsql-jdbc@postgresql.org
>  > Subject: Re: [JDBC] Connection Problem with JDBC
>  >
>  >
>  > Hi all,
>  >
>  > I have added the code to load the drivers using Class.forName in
>  > main, but
>  > when I compile the code I get the following errors :-
>  >
>  > ConnectDemo.java:27: unreported exception
>  > java.lang.ClassNotFoundException;
>  > must be caught or declared to be thrown
>  >             Class.forName("org.postgresql.Driver").newInstance();
>  >                      ^
>  > ConnectDemo.java:27: unreported exception
>  > java.lang.InstantiationException;
>  > must be caught or declared to be thrown
>  >             Class.forName("org.postgresql.Driver").newInstance();
>  >                              ^
>  > 2 errors
>  >
>  > Here is how the program looks now I have added the Class.forName bit :-
>  >
>  > // Import the JDBC classes.
>  > //
>  > import java.sql.*;
>  >
>  > public class ConnectDemo {
>  >
>  >   public static void main(String[] argv) {
>  >
>  >       if (argv.length < 3) {
>  >           usage();
>  >       }
>  >       String url  = argv[0];
>  >       String user = argv[1];
>  >       String pass = argv[2];
>  >
>  >       // Invoke getConnection() to create the
>  >       // connection object.
>  >       //
>  >       Connection conn;
>  >       try {
>  >             Driver driver = (Driver)
>  >                 Class.forName("org.postgresql.Driver").newInstance();
>  >             DriverManager.registerDriver(driver);
>  >           conn = DriverManager.getConnection(url, user, pass);
>  >           System.out.println("Connection successful.");
>  >           System.out.println("Connection as String: " + conn);
>  >       } catch (SQLException e) {
>  >           System.err.println( e.getMessage() );
>  >           System.exit(-1);
>  >       }
>  >
>  >   }
>  >
>  >   static void usage() {
>  >
>  >       System.err.println("Usage:");
>  >       System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
>  >       System.err.println("URL USER PASS");
>  >       System.exit(-1);
>  >
>  >   }
>  >
>  > Do I need to import some other things to get this to work?
>  > Sorry I'm a bit of a novice with all of this.
>  >
>  > Cheers
>  > Steve.
>  >
>  > --------------------------------------------------------------------
>  >
>  > From: "Nick Fankhauser" <nickf@ontko.com>
>  > Reply-To: <nickf@ontko.com>
>  > To: "Steven Murphy" <stevenmurphy@hotmail.com>,
>  > <pgsql-jdbc@postgresql.org>
>  > Subject: Re: [JDBC] Connection Problem with JDBC
>  > Date: Mon, 11 Feb 2002 15:44:04 -0500
>  >
>  >  > The command I am using to run the program is
>  >  > java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
>  >  > jdbc:postgresql:javatest postgres ' '
>  >
>  > I think if it was a classpath problem, you'd be getting a
>  > "ClassNotFoundException" I believe the "No Suitable Driver"
>  > indicates that
>  > among the drivers you have loaded, none matches the database url
>  > passed to
>  > DriverManager.getConnection. ...But the command & url above look
>  > just fine &
>  > I can't see any opportunity in your program for the url to get mangled.
>  >
>  > Have you tried loading the drivers using Class.forName in main?
>  > I'm not sure
>  > what it would tell us if it worked, but if it didn't work that
>  > way, I think
>  > I'd download the driver again.
>  >
>  > -Nick
>  >
>  >
> --------------------------------------------------------------------------
>  > Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax
> 1.765.962.9788
>  > Ray Ontko & Co.     Software Consulting Services
> http://www.ontko.com/
>  >
>  > ---------------------------(end of
> broadcast)---------------------------
>  > TIP 2: you can get off all lists at once with the unregister command
>  >      (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>  >
>  > _________________________________________________________________
>  > MSN Photos is the easiest way to share and print your photos:
>  > http://photos.msn.com/support/worldwide.aspx
>  >
>
>
>
>
>
> "The only Black magic Sabbath ever got into was a box of
> chocolates" - Ozzy
> Osbourne
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>


Re: Connection Problem with JDBC

От
"Dave Cramer"
Дата:
Steven,

Yes, it can't be instantiated, you just need to call
Class.forName("org.postgresql.Driver"); don't call the forInstance()
method on it.

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Steven Murphy
Sent: Monday, February 25, 2002 9:58 AM
To: nickf@ontko.com; pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Connection Problem with JDBC


I have added the extra handlers to the catch SQL exception part of the
code,
but when I compiled the program I got the following error :-

ConnectDemo.java:19: unreported exception
java.lang.IllegalAccessException;
must be caught or declared to be thrown
            Class.forName("org.postgresql.Driver").newInstance();
                             ^
1 error

Below is the code that I added :-

       } catch (SQLException se) {
          System.err.println( se.getMessage() );
       } catch (ClassNotFoundException cnfe) {
          System.err.println( cnfe.getMessage() );
       } catch (InstantiationException ie) {
          System.err.println( ie.getMessage() );
          System.exit(-1);
       }

Do you know what might be causing this error?

Cheers
Steve.

---------------------------------------------------------------

From: "Nick Fankhauser" <nickf@ontko.com>
Reply-To: <nickf@ontko.com>
To: "Steven Murphy" <stevenmurphy@hotmail.com>,
<pgsql-jdbc@postgresql.org>
Subject: RE: [JDBC] Connection Problem with JDBC
Date: Mon, 25 Feb 2002 09:04:22 -0500


In the place where you catch the SQL exception, you just need to add a
couple more exception handlers, so it would look like this:

       } catch (SQLException se) {
           System.err.println( se.getMessage() );
       } catch (ClassNotFoundException cnfe) {
           System.err.println( cnfe.getMessage() );
       } catch (InstantiationException ie) {
           System.err.println( ie.getMessage() );

Then try to compile again.

-NickF

 > -----Original Message-----
 > From: Steven Murphy [mailto:stevenmurphy@hotmail.com]
 > Sent: Monday, February 25, 2002 9:02 AM
 > To: nickf@ontko.com; pgsql-jdbc@postgresql.org
 > Subject: Re: [JDBC] Connection Problem with JDBC
 >
 >
 > Hi all,
 >
 > I have added the code to load the drivers using Class.forName in  >
main, but  > when I compile the code I get the following errors :-  >  >
ConnectDemo.java:27: unreported exception  >
java.lang.ClassNotFoundException;  > must be caught or declared to be
thrown
 >             Class.forName("org.postgresql.Driver").newInstance();
 >                      ^
 > ConnectDemo.java:27: unreported exception
 > java.lang.InstantiationException;
 > must be caught or declared to be thrown
 >             Class.forName("org.postgresql.Driver").newInstance();
 >                              ^
 > 2 errors
 >
 > Here is how the program looks now I have added the Class.forName bit
:-  >  > // Import the JDBC classes.  > //  > import java.sql.*;  >  >
public class ConnectDemo {  >
 >   public static void main(String[] argv) {
 >
 >       if (argv.length < 3) {
 >           usage();
 >       }
 >       String url  = argv[0];
 >       String user = argv[1];
 >       String pass = argv[2];
 >
 >       // Invoke getConnection() to create the
 >       // connection object.
 >       //
 >       Connection conn;
 >       try {
 >             Driver driver = (Driver)
 >                 Class.forName("org.postgresql.Driver").newInstance();
 >             DriverManager.registerDriver(driver);
 >           conn = DriverManager.getConnection(url, user, pass);
 >           System.out.println("Connection successful.");
 >           System.out.println("Connection as String: " + conn);
 >       } catch (SQLException e) {
 >           System.err.println( e.getMessage() );
 >           System.exit(-1);
 >       }
 >
 >   }
 >
 >   static void usage() {
 >
 >       System.err.println("Usage:");
 >       System.err.print("java -Djdbc.drivers=DRIVERCLASS PROGRAM ");
 >       System.err.println("URL USER PASS");
 >       System.exit(-1);
 >
 >   }
 >
 > Do I need to import some other things to get this to work?
 > Sorry I'm a bit of a novice with all of this.
 >
 > Cheers
 > Steve.
 >
 > --------------------------------------------------------------------
 >
 > From: "Nick Fankhauser" <nickf@ontko.com>
 > Reply-To: <nickf@ontko.com>
 > To: "Steven Murphy" <stevenmurphy@hotmail.com>,
 > <pgsql-jdbc@postgresql.org>
 > Subject: Re: [JDBC] Connection Problem with JDBC
 > Date: Mon, 11 Feb 2002 15:44:04 -0500
 >
 >  > The command I am using to run the program is
 >  > java -Djdbc.drivers=org.postgresql.Driver ConnectDemo
 >  > jdbc:postgresql:javatest postgres ' '
 >
 > I think if it was a classpath problem, you'd be getting a
 > "ClassNotFoundException" I believe the "No Suitable Driver"  >
indicates that  > among the drivers you have loaded, none matches the
database url  > passed to  > DriverManager.getConnection. ...But the
command & url above look  > just fine &  > I can't see any opportunity
in your program for the url to get mangled.  >  > Have you tried loading
the drivers using Class.forName in main?  > I'm not sure  > what it
would tell us if it worked, but if it didn't work that  > way, I think
> I'd download the driver again.  >  > -Nick  >  >
------------------------------------------------------------------------
--
 > Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax
1.765.962.9788
 > Ray Ontko & Co.     Software Consulting Services
http://www.ontko.com/
 >
 > ---------------------------(end of
broadcast)---------------------------
 > TIP 2: you can get off all lists at once with the unregister command
 >      (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)
 >
 > _________________________________________________________________
 > MSN Photos is the easiest way to share and print your photos:  >
http://photos.msn.com/support/worldwide.aspx
 >





"The only Black magic Sabbath ever got into was a box of chocolates" -
Ozzy
Osbourne


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)