pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Seema Noor <seema_56@yahoo.com>
To: pgsql-interfaces@postgresql.org
Subject: help in postgres & jdbc
Date: Wed, 21 Mar 2001 14:47:49 -0800 (PST)
Message-ID: <20010321224749.16024.qmail@web3301.mail.yahoo.com> (raw)


i want to know how to start jdbc for postgreql in red
hat linux 7.0. i'm using jdk1.2.2
i have installed red hat linux 7.0 full and there are
four jdbc.......jar files of different version. i
found two methods to do so:
 
1)    i have set the path CLASSPATH=$CLASSPAH
/usr/lib/pgsql/jdbc6.5.1.2.jar
(don't the exact version but it started with 6)
but when ran the file there was exception of
CLASSNOTFOUND. when this exception was caugth it gave
the error message "postgresql/driver"
how do i set the driver? my simplest program is
 
import java.sql.*;

class PostgreSQLTest {
  public static void main (String[] args) {
    try {
      Driver driver = (Driver)
       
Class.forName("postgresql.Driver").newInstance();
      DriverManager.registerDriver(driver);

      String     url = "jdbc:postgresql:javatest"; 
      Connection con =
DriverManager.getConnection(url, "postgres", ""); 
      Statement  stm = con.createStatement(); 
 
      stm.setQueryTimeout(10); 
      ResultSet  rs  = stm.executeQuery("select col1
from test"); 
 
      rs.next(); 
 
      System.out.println(rs.getString(1)); 
 
    } catch (SQLException e) { 
 
      System.out.println("Exception!"); 
      System.out.println(e.toString()); 
  } 
} 

 
where the database name is "javatest" and the table
name is "test". 
in the statement :
Connection con = DriverManager.getConnection(url,
"postgres", ""); 
i even have put "root" instead of "postgres" and put
the root password  (just to try) but it didn't work
this way either.

2)   i found somewhere to compile the driver from
src/interface/jdbc dir (in the postgresql folder) to
get postgresql.jar and then set the class path for
this postgresql.jar
this src/interface/jdbc is not in my system under
postgresql directory when i installed the linux
completely. but i found these directories in
postgresql-7.0.2.tar.

i think that the first method is correct. could u
please help me to get started? is there something i am
missing in the first method?

please reply me soon,
regards,
Seema

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



Message-ID: <20010321224749.16024.qmail@web3301.mail.yahoo.com>
Permalink:  ../20010321224749.16024.qmail@web3301.mail.yahoo.com/
Also on:    postgresql.org/message-id/20010321224749.16024.qmail@web3301.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: seema_56@yahoo.com
  Subject: Re: help in postgres & jdbc
  In-Reply-To: <20010321224749.16024.qmail@web3301.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox