pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQL Error JDBC
2+ messages / 2 participants
[nested] [flat]

* SQL Error JDBC
@ 1999-02-24 03:36 Administration <admin@isorintrade.ca>
  1999-02-24 09:14 ` Re: SQL Error JDBC Peter T Mount <peter@retep.org.uk>
  0 siblings, 1 reply; 2+ messages in thread

From: Administration @ 1999-02-24 03:36 UTC (permalink / raw)
  To: pgsql-interfaces

 I have postgresql running in linux on a network, and I have a sample
program in windows. When I run the following

java -classpath .;c:\jdk1.2\lib\postgresql.jar test

I get this error

sqlexception: no suitable driver

Any ideas??

Henry

Here's my code(i'm pasting it because it's short:)
---------------------------------------------------------------------------------------

import java.sql.*;


public class test {
    public static void main(String args[]) {
        String url = "jdbc:postgres95://isorintrade.ca:5432/ra";
        Connection con;
        String createString;
        createString = "create table COFFEES " +
                            "(COF_NAME VARCHAR(32), " +
                            "SUP_ID INTEGER, " +
                            "PRICE FLOAT, " +
                            "SALES INTEGER, " +
                            "TOTAL INTEGER)";
        Statement stmt;

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

        try {
            con = DriverManager.getConnection(url, "postgres",
"feb_1b42");
            stmt = con.createStatement();
            stmt.executeUpdate(createString);
            stmt.close();
            con.close();

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: SQL Error JDBC
  1999-02-24 03:36 SQL Error JDBC Administration <admin@isorintrade.ca>
@ 1999-02-24 09:14 ` Peter T Mount <peter@retep.org.uk>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter T Mount @ 1999-02-24 09:14 UTC (permalink / raw)
  To: Administration <admin@isorintrade.ca>; +Cc: pgsql-interfaces

On Tue, 23 Feb 1999, Administration wrote:

>  I have postgresql running in linux on a network, and I have a sample
> program in windows. When I run the following
> 
> java -classpath .;c:\jdk1.2\lib\postgresql.jar test
> 
> I get this error
> 
> sqlexception: no suitable driver
> 
> Any ideas??

You still need to load the driver, using something like:

try {
  Class.forName("postgresql.Driver");
} catch(Exception ex) {
  ex.printStackTrace();
  System.exit(1);
}

> Henry
> 
> Here's my code(i'm pasting it because it's short:)
> ---------------------------------------------------------------------------------------
> 
> import java.sql.*;
> 
> 
> public class test {
>     public static void main(String args[]) {
>         String url = "jdbc:postgres95://isorintrade.ca:5432/ra";
>         Connection con;
>         String createString;
>         createString = "create table COFFEES " +
>                             "(COF_NAME VARCHAR(32), " +
>                             "SUP_ID INTEGER, " +
>                             "PRICE FLOAT, " +
>                             "SALES INTEGER, " +
>                             "TOTAL INTEGER)";
>         Statement stmt;
> 
>         try {
>             Class.forName("postgresql.Driver");
>         } catch(java.lang.ClassNotFoundException e) {
>             System.err.print("ClassNotFoundException: ");
>             System.err.println(e.getMessage());
>         }
> 
>         try {
>             con = DriverManager.getConnection(url, "postgres",
> "feb_1b42");
>             stmt = con.createStatement();
>             stmt.executeUpdate(createString);
>             stmt.close();
>             con.close();
> 
>         } catch(SQLException ex) {
>             System.err.println("SQLException: " + ex.getMessage());
>         }
>     }
> }
> 
> 

-- 
       Peter T Mount peter@retep.org.uk
      Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-02-24 09:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-24 03:36 SQL Error JDBC Administration <admin@isorintrade.ca>
1999-02-24 09:14 ` Peter T Mount <peter@retep.org.uk>

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