Re: JDBC in Red hat 9

From: "Joseph Thomas" <greywolf921(at)hotmail(dot)com>
To: blind(at)xythos(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC in Red hat 9
Date: 2003-05-29 21:30:33
Message-ID: Sea2-F356Len4PbO9uV0000b0c7@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

<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>&gt;Ok I am new to Linux, so please bear with me. I am running Red Hat 9
<DIV></DIV>&gt;that comes with PostgreSQL7.3.2-3.
<DIV></DIV>&gt; I have created a "test" database and am trying to access it using
<DIV></DIV>&gt;a java program through jdbc.
<DIV></DIV>&gt;I am recieving and error: "Exception!
<DIV></DIV>&gt;java.lang.ClassNotFoundException: postgresql.Driver"
<DIV></DIV>&gt; I have my CLASSPATH set to point to pg73b1jdbc1.jar,
<DIV></DIV>&gt;pg73b1jdbc2.jar and pg73b1jdbc3.jar.
<DIV></DIV>&gt; I am reading a HOW TO for jdbc and PostgreSQL From
<DIV></DIV>&gt;http://tldp.org/HOWTO/Enterprise-Java-for-Linux-HOWTO-6.html but
<DIV></DIV>&gt;this is for version 6.5, do I need to do anything else?
<DIV></DIV>&gt; here is my java code:
<DIV></DIV>&gt;import java.sql.*;
<DIV></DIV>&gt;
<DIV></DIV>&gt;class PostgreSQLTest {
<DIV></DIV>&gt; public static void main (String[] args) {
<DIV></DIV>&gt; try {
<DIV></DIV>&gt; Driver driver = (Driver)
<DIV></DIV>&gt; Class.forName("postgresql.Driver").newInstance();
<DIV></DIV>&gt; DriverManager.registerDriver(driver);
<DIV></DIV>&gt;
<DIV></DIV>&gt; String url = "jdbc:postgresql:javatest";
<DIV></DIV>&gt; Connection con = DriverManager.getConnection(url, "postgres",
<DIV></DIV>&gt;"");
<DIV></DIV>&gt; Statement stm = con.createStatement();
<DIV></DIV>&gt;
<DIV></DIV>&gt; stm.setQueryTimeout(10);
<DIV></DIV>&gt; ResultSet rs = stm.executeQuery("select col1 from test");
<DIV></DIV>&gt;
<DIV></DIV>&gt; rs.next();
<DIV></DIV>&gt;
<DIV></DIV>&gt; System.out.println(rs.getString(1));
<DIV></DIV>&gt;
<DIV></DIV>&gt; } catch (SQLExcept ion e) {
<DIV></DIV>&gt;
<DIV></DIV>&gt; System.out.println("Exception!");
<DIV></DIV>&gt; System.out.println(e.toString());
<DIV></DIV>&gt; }
<DIV></DIV>&gt;}
<DIV></DIV>&gt;
<DIV></DIV>&gt;------------------------------------------------------------------------
<DIV></DIV>&gt;Tired of spam? Get advanced junk mail protection
<DIV></DIV>&gt;<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>

Attachment Content-Type Size
unknown_filename text/html 3.5 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-05-29 23:02:01 Re: unsuscribe
Previous Message Dmitry Tkach 2003-05-29 19:56:45 Array.getArray ()