<html><div style='background-color:'><DIV>
<P>ok, </P>
<P>I updated the CLASSPATH to have pgb1jdbc2.jar, and modfied my code to say "Class.forName("org.postgresql.Driver").newInstance(); "</P>
<P>but I am still getting the error "Exception! java.lang.ClassNotFoundException: org.postgresql.Driver" <BR><BR></P></DIV>
<DIV></DIV>----Original Message Follows----
<DIV></DIV>From: Barry Lind <BLIND(at)XYTHOS(dot)COM>
<DIV></DIV>To: Joseph Thomas <GREYWOLF921(at)HOTMAIL(dot)COM>
<DIV></DIV>CC: pgsql-jdbc(at)postgresql(dot)org
<DIV></DIV>Subject: Re: [JDBC] JDBC in Red hat 9
<DIV></DIV>Date: Wed, 28 May 2003 21:58:02 -0700
<DIV></DIV>
<DIV></DIV>Joseph,
<DIV></DIV>
<DIV></DIV>Two things wrong that I can see:
<DIV></DIV>
<DIV></DIV>1) The driver class is now org.postgresql.Driver (not postgresql.Driver)
<DIV></DIV>2) You only include one of the jar files in the classpath (the one that corresponds to the version of java/jdbc you are running: jdbc1 = jdk1.1, jdbc2= jdk1.2 and 1.3, jdbc3= jdk1.4
<DIV></DIV>
<DIV></DIV>thanks,
<DIV></DIV>--Barry
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>Joseph Thomas wrote:
<DIV></DIV>>Ok I am new to Linux, so please bear with me. I am running Red Hat 9
<DIV></DIV>>that comes with PostgreSQL7.3.2-3.
<DIV></DIV>> I have created a "test" database and am trying to access it using
<DIV></DIV>>a java program through jdbc.
<DIV></DIV>>I am recieving and error: "Exception!
<DIV></DIV>>java.lang.ClassNotFoundException: postgresql.Driver"
<DIV></DIV>> I have my CLASSPATH set to point to pg73b1jdbc1.jar,
<DIV></DIV>>pg73b1jdbc2.jar and pg73b1jdbc3.jar.
<DIV></DIV>> I am reading a HOW TO for jdbc and PostgreSQL From
<DIV></DIV>>http://tldp.org/HOWTO/Enterprise-Java-for-Linux-HOWTO-6.html but
<DIV></DIV>>this is for version 6.5, do I need to do anything else?
<DIV></DIV>> here is my java code:
<DIV></DIV>>import java.sql.*;
<DIV></DIV>>
<DIV></DIV>>class PostgreSQLTest {
<DIV></DIV>> public static void main (String[] args) {
<DIV></DIV>> try {
<DIV></DIV>> Driver driver = (Driver)
<DIV></DIV>> Class.forName("postgresql.Driver").newInstance();
<DIV></DIV>> DriverManager.registerDriver(driver);
<DIV></DIV>>
<DIV></DIV>> String url = "jdbc:postgresql:javatest";
<DIV></DIV>> Connection con = DriverManager.getConnection(url, "postgres",
<DIV></DIV>>"");
<DIV></DIV>> Statement stm = con.createStatement();
<DIV></DIV>>
<DIV></DIV>> stm.setQueryTimeout(10);
<DIV></DIV>> ResultSet rs = stm.executeQuery("select col1 from test");
<DIV></DIV>>
<DIV></DIV>> rs.next();
<DIV></DIV>>
<DIV></DIV>> System.out.println(rs.getString(1));
<DIV></DIV>>
<DIV></DIV>> } catch (SQLExcept ion e) {
<DIV></DIV>>
<DIV></DIV>> System.out.println("Exception!");
<DIV></DIV>> System.out.println(e.toString());
<DIV></DIV>> }
<DIV></DIV>>}
<DIV></DIV>>
<DIV></DIV>>------------------------------------------------------------------------
<DIV></DIV>>Tired of spam? Get advanced junk mail protection
<DIV></DIV>><HTTP: 2734??PS="" 8HMLENUS g.msn.com> with MSN 8.
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>---------------------------(end of broadcast)---------------------------
<DIV></DIV>TIP 5: Have you checked our extensive FAQ?
<DIV></DIV>
<DIV></DIV>http://www.postgresql.org/docs/faqs/FAQ.html
<DIV></DIV></div><br clear=all><hr>Tired of spam? Get <a href="http://g.msn.com/8HMHENUS/2734??PS=">advanced junk mail protection</a> with MSN 8.</html>