pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
a JDBC applet
4+ messages / 4 participants
[nested] [flat]

* a JDBC applet
@ 1998-07-09 14:49 Cyril FERRAND <cferran2@iutsoph.unice.fr>
  1998-07-09 15:25 ` Re: [INTERFACES] a JDBC applet Andrew R. Jackson <ajackson@dezines.com>
  1998-07-09 18:36 ` Re: [INTERFACES] a JDBC applet Anil Amarakoon <anil@server.awcoldstream.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Cyril FERRAND @ 1998-07-09 14:49 UTC (permalink / raw)
  To: pgsql-interfaces

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

--
*************************************************************************
*       Cyril Ferrand : mailto:cyril.ferrand@sophia.inria.fr            *
*            http://www.mygale.org/05/ironmask                          *
*************************************************************************






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] a JDBC applet
  1998-07-09 14:49 a JDBC applet Cyril FERRAND <cferran2@iutsoph.unice.fr>
@ 1998-07-09 15:25 ` Andrew R. Jackson <ajackson@dezines.com>
  1998-07-09 17:04   ` Re: [INTERFACES] a JDBC applet Peter T Mount <peter@retep.org.uk>
  1 sibling, 1 reply; 4+ messages in thread

From: Andrew R. Jackson @ 1998-07-09 15:25 UTC (permalink / raw)
  To: pgsql-interfaces

At 04:49 PM 09/07/98 +0200, Cyril FERRAND wrote:
>    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.

I have a general question related to this connecting to the DB via applet: would this require the applet user's domain to be in the pg_hba.conf file? I couldn't successfully run basic.java (one of the examples) locally here and have it connect to Postgres at school without doing this first.

If one wants an applet that can run anywhere to have access, then you'd have to set up Postgres not to only accept connections from certain domains, but all domains, right? I could be way off here since I am a lowly Postgres *user*, and most docs/discussion speak to people who have Postgres admin/config abilities, which is unfortunate.

Anyway, my approach to the applet-Postgres issue is a client-server one. Applets are clients that connect to a server running on the same machine running the Postgres stuff which mediates the database connection. This will keep the sysadmin people happy :) At least at my school...

Andrew




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] a JDBC applet
  1998-07-09 14:49 a JDBC applet Cyril FERRAND <cferran2@iutsoph.unice.fr>
  1998-07-09 15:25 ` Re: [INTERFACES] a JDBC applet Andrew R. Jackson <ajackson@dezines.com>
@ 1998-07-09 17:04   ` Peter T Mount <peter@retep.org.uk>
  0 siblings, 0 replies; 4+ messages in thread

From: Peter T Mount @ 1998-07-09 17:04 UTC (permalink / raw)
  To: Andrew R. Jackson <ajackson@dezines.com>; +Cc: pgsql-interfaces

On Thu, 9 Jul 1998, Andrew R. Jackson wrote:

> At 04:49 PM 09/07/98 +0200, Cyril FERRAND wrote:
> >    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.
> 
> I have a general question related to this connecting to the DB via
> applet: would this require the applet user's domain to be in the
> pg_hba.conf file? I couldn't successfully run basic.java (one of the
> examples) locally here and have it connect to Postgres at school without
> doing this first. 

Yes, anything that connects to the server needs to be in pg_hba.conf

> If one wants an applet that can run anywhere to have access, then you'd
> have to set up Postgres not to only accept connections from certain
> domains, but all domains, right? I could be way off here since I am a
> lowly Postgres *user*, and most docs/discussion speak to people who have
> Postgres admin/config abilities, which is unfortunate. 

You are correct, although you would do this at a database by database
level, rather than all databases.

> Anyway, my approach to the applet-Postgres issue is a client-server one.
> Applets are clients that connect to a server running on the same machine
> running the Postgres stuff which mediates the database connection. This
> will keep the sysadmin people happy :) At least at my school... 

Personally, I work with Java applications rather than applets, because my
code isn't really suited to a browser environment. Most of the time it's
on the same machine as postgres, but a lot of the time, it's another
machine on my local network, so it's not much of a problem.

But for those who do write applets for External web use, they have to
account for it.

I think the following should work:

host	mydb	0.0.0.0	0.0.0.0	password

I'd ill advise using trust, as they could get in as the DBA, and ident
wouldn't work well with most browsers (actually I can't think of any that
would work).

-- 
Peter T Mount peter@retep.org.uk or petermount@earthling.net
Main Homepage: http://www.retep.org.uk
************ Someday I may rebuild this signature completely ;-) ************
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] a JDBC applet
  1998-07-09 14:49 a JDBC applet Cyril FERRAND <cferran2@iutsoph.unice.fr>
@ 1998-07-09 18:36 ` Anil Amarakoon <anil@server.awcoldstream.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Anil Amarakoon @ 1998-07-09 18:36 UTC (permalink / raw)
  To: Cyril.Ferrand@sophia.inria.fr; +Cc: 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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~1998-07-09 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-07-09 14:49 a JDBC applet Cyril FERRAND <cferran2@iutsoph.unice.fr>
1998-07-09 15:25 ` Andrew R. Jackson <ajackson@dezines.com>
1998-07-09 17:04   ` Peter T Mount <peter@retep.org.uk>
1998-07-09 18:36 ` Anil Amarakoon <anil@server.awcoldstream.com>

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