Re: PostgreSQL-JDBC driver

From: "sourabh dixit" <sourabh(dot)dixit(at)wipro(dot)com>
To: Peter T Mount <peter(at)retep(dot)org(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL-JDBC driver
Date: 2001-03-21 11:50:02
Message-ID: 8de9b7e2.b7e28de9@wipro.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello !
My program is given below and the errors which Iam getting on executing
the program is "ClassNotFoundException:org.postgresql.Driver
SQLException:No suitable driver".
Can you tell me what's wrong in my program?

Regards,
Sourabh

import java.sql.*;

public class DM
{
public static void main(String args[])
{
String url = "jdbc:postgresql:testdb";

Connection con;
String createString;
createString = "create MyInfo table "+"(INTERFACE_TYPE
INTEGER,"+"EQUIPMENT_TYPE INTEGER)";

Statement stmt;

try {
Class.forName("org.postgresql.Driver");
}
catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFoundException:");
System.err.println(e.getMessage());
}

try {
con = DriverManager.getConnection(url,"sdixit","sdixit");

stmt = con.createStatement();

stmt.executeUpdate(createString);

stmt.close();

con.close();

} catch(SQLException ex)
{
System.err.println("SQLException:"+ex.getMessage());
}
}

----- Original Message -----
From: Peter T Mount <peter(at)retep(dot)org(dot)uk>
Date: Wednesday, March 21, 2001 4:56 pm
Subject: Re: [HACKERS] PostgreSQL-JDBC driver

> Quoting sourabh dixit <sourabh(dot)dixit(at)wipro(dot)com>:
>
> >
> >
> > -----
> >
> > Hi,
> >
> > I am trying to access PostGreSQL database running at the default
> port> 5432
> > using JDBC. But the application is giving error "Cannot find
> suitable> driver". I have included JDBC driver JAR file in my
> CLASSPATH and
> > Class.forName("org.postgresql.Driver") is loading driver
> successfully.> Can anybody tell me how to go about to solve the
> problem?
> Sounds like your URL is wrong. Make sure it begins with
> jdbc:postgresql:
> Peter
>
> --
> Peter Mount peter(at)retep(dot)org(dot)uk
> PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
> RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/
>

Browse pgsql-hackers by date

  From Date Subject
Next Message Adriaan Joubert 2001-03-21 13:10:55 Re: int8 bug on Alpha
Previous Message Thomas Lockhart 2001-03-21 11:46:12 Re: int8 bug on Alpha