Received: from awcoldstream.com ([206.130.14.2]) by hub.org (8.8.8/8.7.5) with ESMTP id OAA26763 for ; Thu, 9 Jul 1998 14:26:28 -0400 (EDT) Received: from awcoldstream.com (206.248.140.39) by awcoldstream.com with ESMTP (Apple Internet Mail Server 1.1.1); Thu, 9 Jul 1998 13:23:55 -0500 Message-ID: <35A50D98.2E89FFCC@awcoldstream.com> Date: Thu, 09 Jul 1998 13:36:08 -0500 From: Anil Amarakoon X-Mailer: Mozilla 4.04 [en] (WinNT; I) MIME-Version: 1.0 To: Cyril.Ferrand@sophia.inria.fr CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] a JDBC applet References: <35A4D860.2B8E21D8@iutsoph.unice.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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