Thread: Re: JDBC for PostgreSql

Re: JDBC for PostgreSql

From
Liam Stewart
Date:
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@cmet.net
> Fono: (56)(2) 2513333
> Anexo: 413
>
> CMET S.A.C.I.

--
Liam Stewart :: Red Hat Canada, Ltd. :: liams@redhat.com