Re: JDBC for PostgreSql

From: Liam Stewart <liams(at)redhat(dot)com>
To: Patricio Muñoz <pmunoz(at)cmet(dot)net>
Cc: PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC for PostgreSql
Date: 2002-05-07 14:55:31
Message-ID: 20020507105531.D8827@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


I'm not too sure about what's going on either. What version of Java do
you have and how are you running the program? Perhaps the driver jar
file is corrupted: does

$ jar -tf /usr/java/jdk/jre/lib/ext/jdbc7.1-1.2.jar

produce a list of files or nothing?

Liam

On Mon, May 06, 2002 at 03:53:17PM -0400, Patricio Muñoz wrote:
> Hi,
> when run the sample application, the show message is:
> "ClassNotFoundException: org/postgresql/Driver"
> I don´t understand what's up
>
> the enviroment
> $CLASSPATH=/usr/java/jdk:/usr/java/jdk/lib:/home/pmunoz/java/:/usr/java/jdk/
> jre/lib/ext/jdbc7.1-1.2.jar.
> the driver installed in /usr/java/jdk/jre/lib/ext/jdbc7.1-1.2.jar
>
> O.S. RedHat 7.2
> PostgeSQL 7.1.3
>
> sample:
> import java.sql.*;
>
> class PostgreSQLTest
> {
> public static void main (String[] args)
> {
> try
> {
> Class.forName("org.postgresql.Driver");
>
> String url = "jdbc:postgresql:webcam";
> Connection con = DriverManager.getConnection(url, "postgres",
> "postgres");
> Statement stm = con.createStatement();
>
> stm.setQueryTimeout(10);
> ResultSet rs = stm.executeQuery("select login from cliente");
>
> rs.next();
>
> System.out.println(rs.getString("login"));
>
> }
>
> catch(java.lang.ClassNotFoundException e)
> {
> System.err.print("ClassNotFoundException: ");
> System.err.println(e.getMessage());
> }
>
> catch (SQLException e)
> {
> System.out.println("Exception!");
> System.out.println(e.toString());
> }
> }
> }
>
> Regards,
>
> Patricio Muñoz M.
> Depto. Desarrollo de Aplicaciones.
> Mail: pmunoz(at)cmet(dot)net
> Fono: (56)(2) 2513333
> Anexo: 413
>
> CMET S.A.C.I.

--
Liam Stewart :: Red Hat Canada, Ltd. :: liams(at)redhat(dot)com

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-05-07 15:52:09 Re: Problems with "order by clause"
Previous Message Dave Cramer 2002-05-07 13:22:35 Re: Looking for PostGres jdbc bindings