pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eric Wright <eric.wright@shaw.ca>
To: pgsql-jdbc@postgresql.org
Subject: JDBC Connection
Date: Sun, 11 Jul 2004 13:26:31 -0700
Message-ID: <001c01c46785$5a943470$6601a8c0@numbertwo> (raw)

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

view thread (19+ messages)  latest in thread

Message-ID: <001c01c46785$5a943470$6601a8c0@numbertwo>
Permalink:  ../001c01c46785$5a943470$6601a8c0@numbertwo/
Also on:    postgresql.org/message-id/001c01c46785$5a943470$6601a8c0@numbertwo

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: eric.wright@shaw.ca
  Subject: Re: JDBC Connection
  In-Reply-To: <001c01c46785$5a943470$6601a8c0@numbertwo>
  References: <001c01c46785$5a943470$6601a8c0@numbertwo>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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