Re: [INTERFACES] a JDBC applet

From: Anil Amarakoon <anil(at)server(dot)awcoldstream(dot)com>
To: Cyril(dot)Ferrand(at)sophia(dot)inria(dot)fr
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] a JDBC applet
Date: 1998-07-09 18:36:08
Message-ID: 35A50D98.2E89FFCC@awcoldstream.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi!

Postgres 6.3.2 - Redhat 4.2, 5.0, 5.1, (JDK-from blackdown.org) Windoz NT
4.0 & 95 (Sun JDK) Mac (Metrowerk-JDK lite)
=====================================================================
Connection conn;
Statement stmt;
Resultset rest;

To get Connection:

public void openDir() {

try {
Class.forName("postgresql.Driver");
conn=DriverManager.getConnection("jdbc:postgresql://liman.awcl.com:5432/adsys","user
Name","passwd");
}catch(SQLException sqle) {
System.out.println("connection failed");
sqle.printStackTrace();
}catch(ClassNotFoundException cnfe) { //optional
System.out.println("Class not found");
cnfe.printStackTrace();
}catch(Exception e) { //optional
e.printStackTrace(); }

}

then query:

public void getCusNum()
{
String query1 = "select cnumber from tcustomer";
vcusNum = new Vector();
try{
stmt = conn.createStatement();
rest = stmt.executeQuery(query1);

while (rest.next()) {
vcusNum.addElement(new Integer(rest.getInt(1)));
}
}catch(SQLException sqle) {
}catch(Exception e) {}

}

close the connection:

public void closeDirectory() {

try{
if(rest != null){
rest.close();
rest = null; }
if(stmt != null) {
stmt.close();
stmt = null; }
if(conn != null) {
conn.close();
conn = null; }
} catch(SQLException sqle) {
sqle.printStackTrace(); }
}

Cyril FERRAND wrote:

> Hello
>
> I look for an example of a Java applet to communicate with a
> postgresql base via JBDC. Because I have a lot of pb with my own one.
> A example like basic.java example is ok.
>
> thanks...
>
> Cyril

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Cyril FERRAND 1998-07-10 07:15:35 perl crashed
Previous Message Len Morgan 1998-07-09 17:50:11 ODBC Problem