I seem to be having some problems w/ the psql jdbc driver.  I'm able to load the driver, but as soon as I try to connect w/ the database. here's my code:

import java.sql.*;

public class dataBase {
    public static void main(String [] args){
        try {
            Class.forName("org.postgresql.DriverClass").newInstance();
            System.out.println("Driver Loaded Successfully");
        } catch (Exception e) {
            System.out.println("Unable to Load Driver " + e.getMessage() );
        }
        try {
            Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost/mapping",
                "mapping", "");
        } catch (SQLException e) {
            System.out.println("SQLException: " + e.getMessage());
        }
    }
}

When I run this code as shown, I get the following output:
Driver Loaded Successfully
SQLException: No suitable driver

I'm trying to connect to the database "mapping" under the user "mapping" w/ no password. Does anybody know what I'm doing wrong? I'm running psql ver 7.0.2 and jdbc driver "jdbc7.0-1.2.jar" and the java 1.3 jdk.  Any comments or suggestions would be greatly appreciated. thanks.







I seem to be having some problems w/ the psql jdbc 
driver.  I'm able to load the driver, but as soon as I try to connect w/ 
the database. here's my code:
 
import java.sql.*;
 
public class dataBase {
    public static void main(String 
[] args){
        try 
{
        
    
Class.forName("org.postgresql.DriverClass").newInstance();
        
    System.out.println("Driver Loaded 
Successfully");
        } catch 
(Exception e) {
        
    System.out.println("Unable to Load Driver " + e.getMessage() 
);
        
}
        try 
{
        
    Connection conn = 
DriverManager.getConnection("jdbc:postgresql://localhost/mapping",
        
        "mapping", "");
        } catch 
(SQLException e) {
        
    System.out.println("SQLException: " + 
e.getMessage());
        
}
    }
}
 
When I run this code as shown, I get the following 
output:
Driver Loaded Successfully
SQLException: No suitable driver
 
I'm trying to connect to the database "mapping" 
under the user "mapping" w/ no password. Does anybody know what I'm doing wrong? 
I'm running psql ver 7.0.2 and jdbc driver "jdbc7.0-1.2.jar" and the java 1.3 
jdk.  Any comments or suggestions would be greatly appreciated. 
thanks.
Fri, 23 Feb 2001 09:58:45 -0700
"Andy Engdahl" <andy@crophailmanagement.com>
PostgreSQL JDBC
On Fri, 23 Feb 2001, Andy Engdahl wrote:

> I seem to be having some problems w/ the psql jdbc driver.  I'm able to load the driver, but as soon as I try to connect w/ the database. here's my code:
> 
> import java.sql.*;
> 
> public class dataBase {
>     public static void main(String [] args){
>         try {
>             Class.forName("org.postgresql.DriverClass").newInstance();

 The class instance will load successfully, but this isn't what you
want. Replace org.postgresql.DriverClass with org.postgresql.Driver.

Jeff

-- 
Errors have occurred.
We won't tell you where or why.
Lazy programmers.
		-- Hacking haiku


Fri, 23 Feb 2001 13:05:00 -0500 (EST)
Jeff Duffy <jduffy@greatbridge.com>
Re: PostgreSQL JDBC
At 13:05 23/02/01 -0500, Jeff Duffy wrote:
>On Fri, 23 Feb 2001, Andy Engdahl wrote:
>
> > I seem to be having some problems w/ the psql jdbc driver.  I'm able to 
> load the driver, but as soon as I try to connect w/ the database. here's 
> my code:
> >
> > import java.sql.*;
> >
> > public class dataBase {
> >     public static void main(String [] args){
> >         try {
> >             Class.forName("org.postgresql.DriverClass").newInstance();
>
>  The class instance will load successfully, but this isn't what you
>want. Replace org.postgresql.DriverClass with org.postgresql.Driver.


I'd also remove the newInstance() as it will create a second object that 
will just occupy memory (the class has a static initialiser).

Peter



Sat, 24 Feb 2001 17:04:59 +0000
Peter Mount <peter@retep.org.uk>
Re: Re: PostgreSQL JDBC