JDBC Connection

Lists: pgsql-jdbc
From: Eric Wright <eric(dot)wright(at)shaw(dot)ca>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC Connection
Date: 2004-07-11 20:26:31
Message-ID: 001c01c46785$5a943470$6601a8c0@numbertwo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hello,

I am having some trouble connecting to my postgres database.
I have started off with a simple test class to make and test a connection. When I run the simple tester I am getting the following output:

The connection failed.
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at app.dao.ConnectionTest.main(ConnectionTest.java:28)

From the following test class:

package app.dao;
import java.sql.*;

public class ConnectionTest {
public static void main(String[] args) {
String url = "jdbc:postgres://192.168.1.101/asset";
String user = "asset$admin";
String pwd = "password";
try {
Class.forName("org.postgresql.Driver");
Connection con = DriverManager.getConnection(url, user, pwd);
if(!con.isClosed()){
System.out.println("The connection succeeded");
con.close();
}
}catch(Exception e){
e.printStackTrace();
System.out.println("The connection failed.");
}
}
}

I have read the information at http://www.fankhausers.com/postgresql/jdbc/#nosuitabledriver
I am using Eclipse 3.0 and trying it run it in the debugger.
I am using postgresql 7.4, JDK 1.4, and pg74.214.jdbc3.jar

Any help that you can provide would be great.

Thanks Eric W


From: Kris Jurka <books(at)ejurka(dot)com>
To: Eric Wright <eric(dot)wright(at)shaw(dot)ca>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC Connection
Date: 2004-07-12 01:54:07
Message-ID: Pine.BSO.4.56.0407112053280.22112@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Sun, 11 Jul 2004, Eric Wright wrote:

> Hello,
>
> I am having some trouble connecting to my postgres database. I have
> started off with a simple test class to make and test a connection. When
> I run the simple tester I am getting the following output:
>
> The connection failed.
> java.sql.SQLException: No suitable driver
> String url = "jdbc:postgres://192.168.1.101/asset";

The URL must start with jdbc:postgresql not postgres.

Kris Jurka


From: Eric Wright <eric(dot)wright(at)shaw(dot)ca>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC Connection
Date: 2004-07-12 05:15:10
Message-ID: 000501c467cf$34373120$6601a8c0@numbertwo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Thanks Kris, my bad...

I will put on the pointy hat and sit in the corner until the end of class.

Eric

----- Original Message -----
From: "Kris Jurka" <books(at)ejurka(dot)com>
To: "Eric Wright" <eric(dot)wright(at)shaw(dot)ca>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Sent: Sunday, July 11, 2004 6:54 PM
Subject: Re: [JDBC] JDBC Connection

>
>
> On Sun, 11 Jul 2004, Eric Wright wrote:
>
> > Hello,
> >
> > I am having some trouble connecting to my postgres database. I have
> > started off with a simple test class to make and test a connection. When
> > I run the simple tester I am getting the following output:
> >
> > The connection failed.
> > java.sql.SQLException: No suitable driver
> > String url = "jdbc:postgres://192.168.1.101/asset";
>
> The URL must start with jdbc:postgresql not postgres.
>
> Kris Jurka
>