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@retep.org.uk>
Date: Wednesday, March 21, 2001 4:56 pm
Subject: Re: [HACKERS] PostgreSQL-JDBC driver
> Quoting sourabh dixit <sourabh.dixit@wipro.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@retep.org.uk
> PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
> RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/
>