JDBC in Red hat 9

From: "Joseph Thomas" <greywolf921(at)hotmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC in Red hat 9
Date: 2003-05-29 04:34:06
Message-ID: Sea2-F50NjVuMhvqgSt0000e3d3@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Attachment Content-Type Size
unknown_filename text/html 2.1 KB

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-05-29 04:49:01 Re: JDBC: Better initial capacity for StringBuffers reduces
Previous Message Rupa Schomaker 2003-05-28 19:42:56 Re: WARNING: ROLLBACK: no transaction in progress