Thread: access from java does not work in an applet!

access from java does not work in an applet!

From
"B.N.V. Raman"
Date:
Hello,

Using JDBC, I was making a web access program for my postgres database.
While the same code works in a Java program, when i convert it into a Java
applet, i get a netscape security exception. What do i do?

Thanks,

Raman.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01


RE: access from java does not work in an applet!

From
Joe Shevland
Date:
Applets sit in security 'sandbox'... you can only make connections back to
the applet's originating server from the applet, so if your Postgres
database is on the web server it'll be OK (barring firewalls etc.) but if
its on another server the applet context will complain.

Your alternatives are to digitally sign the applet and loosen the security
restrictions, provide a proxying service from your web server to the
database server (or a natd rule), and potentially some other options that my
shrivelled brain can't come up with at the moment ;)

Regards,
Joe


> -----Original Message-----
> From: B.N.V. Raman [mailto:raman@myself.com]
> Sent: Tuesday, 15 May 2001 10:19 PM
> To: Pgsql-Jdbc@Postgresql. Org
> Subject: [JDBC] access from java does not work in an applet!
>
>
> Hello,
>
> Using JDBC, I was making a web access program for my postgres
> database.
> While the same code works in a Java program, when i convert
> it into a Java
> applet, i get a netscape security exception. What do i do?
>
> Thanks,
>
> Raman.
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>

RE: access from java does not work in an applet!

From
"B.N.V. Raman"
Date:
Thank you both, Joe & Antonio...

Yes, my webserver and database server are on the same machine. That is why i
can't understand the error. Sorry, I forgot to mention that in my mail. What
could be the problem?

Thanks..

Raman.

> -----Original Message-----
> From: Joe Shevland [mailto:J.Shevland@eclipsegroup.com.au]
> Sent: 15 May 2001 07:20
> To: 'B.N.V. Raman'; Pgsql-Jdbc@Postgresql. Org
> Subject: RE: [JDBC] access from java does not work in an applet!
>
>
> Applets sit in security 'sandbox'... you can only make connections back to
> the applet's originating server from the applet, so if your Postgres
> database is on the web server it'll be OK (barring firewalls etc.) but if
> its on another server the applet context will complain.
>
> Your alternatives are to digitally sign the applet and loosen the security
> restrictions, provide a proxying service from your web server to the
> database server (or a natd rule), and potentially some other
> options that my
> shrivelled brain can't come up with at the moment ;)
>
> Regards,
> Joe
>
>
> > -----Original Message-----
> > From: B.N.V. Raman [mailto:raman@myself.com]
> > Sent: Tuesday, 15 May 2001 10:19 PM
> > To: Pgsql-Jdbc@Postgresql. Org
> > Subject: [JDBC] access from java does not work in an applet!
> >
> >
> > Hello,
> >
> > Using JDBC, I was making a web access program for my postgres
> > database.
> > While the same code works in a Java program, when i convert
> > it into a Java
> > applet, i get a netscape security exception. What do i do?
> >
> > Thanks,
> >
> > Raman.
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01


Re: access from java does not work in an applet!

From
The Boss
Date:
You may need to GRANT access on the database to the  user which the applet
belongs (nobody?).


"B.N.V. Raman" wrote:

> Thank you both, Joe & Antonio...
>
> Yes, my webserver and database server are on the same machine. That is why i
> can't understand the error. Sorry, I forgot to mention that in my mail. What
> could be the problem?
>
> Thanks..
>
> Raman.
>
> > -----Original Message-----
> > From: Joe Shevland [mailto:J.Shevland@eclipsegroup.com.au]
> > Sent: 15 May 2001 07:20
> > To: 'B.N.V. Raman'; Pgsql-Jdbc@Postgresql. Org
> > Subject: RE: [JDBC] access from java does not work in an applet!
> >
> >
> > Applets sit in security 'sandbox'... you can only make connections back to
> > the applet's originating server from the applet, so if your Postgres
> > database is on the web server it'll be OK (barring firewalls etc.) but if
> > its on another server the applet context will complain.
> >
> > Your alternatives are to digitally sign the applet and loosen the security
> > restrictions, provide a proxying service from your web server to the
> > database server (or a natd rule), and potentially some other
> > options that my
> > shrivelled brain can't come up with at the moment ;)
> >
> > Regards,
> > Joe
> >
> >
> > > -----Original Message-----
> > > From: B.N.V. Raman [mailto:raman@myself.com]
> > > Sent: Tuesday, 15 May 2001 10:19 PM
> > > To: Pgsql-Jdbc@Postgresql. Org
> > > Subject: [JDBC] access from java does not work in an applet!
> > >
> > >
> > > Hello,
> > >
> > > Using JDBC, I was making a web access program for my postgres
> > > database.
> > > While the same code works in a Java program, when i convert
> > > it into a Java
> > > applet, i get a netscape security exception. What do i do?
> > >
> > > Thanks,
> > >
> > > Raman.
> >
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly


Re: access from java does not work in an applet!

From
Tom Lane
Date:
"B.N.V. Raman" <raman@myself.com> writes:
> Yes, my webserver and database server are on the same machine. That is why i
> can't understand the error. Sorry, I forgot to mention that in my mail. What
> could be the problem?

Perhaps the access from the webserver is coming from a virtual IP
address that is not listed in pg_hba.conf.

            regards, tom lane

Re: access from java does not work in an applet!

From
"George Koras"
Date:
Hi Raman,

What driver are you using? Where is it stored (do the users download it
along with the applet or do you require them to install it locally)? And
what is the exact message of the exception you get?

You might find the following links helpful:

http://jdbc.postgresql.org/docs/applet.html
http://jdbc.postgresql.org/docs/
http://java.sun.com/sfaq/

Cheers.

----- Original Message -----
From: B.N.V. Raman <raman@myself.com>
To: Joe Shevland <J.Shevland@eclipsegroup.com.au>; Pgsql-Jdbc@Postgresql.
Org <pgsql-jdbc@postgresql.org>
Sent: Tuesday, May 15, 2001 8:34 PM
Subject: RE: access from java does not work in an applet!


> Thank you both, Joe & Antonio...
>
> Yes, my webserver and database server are on the same machine. That is why
i
> can't understand the error.
> -- snip --

> > -----Original Message-----
> > From: Joe Shevland [mailto:J.Shevland@eclipsegroup.com.au]
> > Sent: 15 May 2001 07:20
> > To: 'B.N.V. Raman'; Pgsql-Jdbc@Postgresql. Org
> > Subject: RE: [JDBC] access from java does not work in an applet!
> >
> >
> > Applets sit in security 'sandbox'... you can only make connections back
to
> > the applet's originating server from the applet, so if your Postgres
> > database is on the web server it'll be OK (barring firewalls etc.) but
if
> > its on another server the applet context will complain.
> >
> > -- snip --
> >
> > > -----Original Message-----
> > > From: B.N.V. Raman [mailto:raman@myself.com]
> > > Sent: Tuesday, 15 May 2001 10:19 PM
> > > To: Pgsql-Jdbc@Postgresql. Org
> > > Subject: [JDBC] access from java does not work in an applet!
> > >
> > >
> > > Hello,
> > >
> > > Using JDBC, I was making a web access program for my postgres
> > > database.
> > > While the same code works in a Java program, when i convert
> > > it into a Java
> > > applet, i get a netscape security exception. What do i do?
> > >



RE: access from java does not work in an applet!

From
"B.N.V. Raman"
Date:
Thank you George & Everybody else also,

The docs have the required information. I just didn't look in there.. it
seems accessing JDBC within an applet is a bad idea.... Peter Mount has an
alternative...

<quoting docs>
There's several problems here:

You have to configure pg_hba.conf to allow any host (and I mean any) access
to the database. Because under SQL you can't prevent a user from creating
tables (you can only deny to an existing object) you have one hell of a
security hole.
Another security feature with applets that (unless signed) they can only
access the web server they connect to. This means that this is also your
database server. Big security problem.
Not all browsers support the same JDK. Most support 1.1, but some now
support 1.2. Because there are different specifications for JDBC involved
you have a problem. Also it's not easy to detect the versions in a portable
manner.
Not all browsers can download multiple .jar files with an applet
The driver is big (~100K compressed), and some browsers can't handle
compressed .jar files.
The best way to access your database from an applet is to have the applet
talk to a java application on your server, and it uses JDBC to the database.
It's a lot more secure, faster to the user and more importantly more stable.

</unquoting docs>

I'll just do as he says...

Raman.

> -----Original Message-----
> From: George Koras [mailto:gkoras@cres.gr]
> Sent: 16 May 2001 07:23
> To: B.N.V. Raman; Pgsql-Jdbc@Postgresql. Org
> Subject: Re: access from java does not work in an applet!
>
>
> Hi Raman,
>
> What driver are you using? Where is it stored (do the users download it
> along with the applet or do you require them to install it locally)? And
> what is the exact message of the exception you get?
>
> You might find the following links helpful:
>
> http://jdbc.postgresql.org/docs/applet.html
> http://jdbc.postgresql.org/docs/
> http://java.sun.com/sfaq/
>
> Cheers.
>
> ----- Original Message -----
> From: B.N.V. Raman <raman@myself.com>
> To: Joe Shevland <J.Shevland@eclipsegroup.com.au>; Pgsql-Jdbc@Postgresql.
> Org <pgsql-jdbc@postgresql.org>
> Sent: Tuesday, May 15, 2001 8:34 PM
> Subject: RE: access from java does not work in an applet!
>
>
> > Thank you both, Joe & Antonio...
> >
> > Yes, my webserver and database server are on the same machine.
> That is why
> i
> > can't understand the error.
> > -- snip --
>
> > > -----Original Message-----
> > > From: Joe Shevland [mailto:J.Shevland@eclipsegroup.com.au]
> > > Sent: 15 May 2001 07:20
> > > To: 'B.N.V. Raman'; Pgsql-Jdbc@Postgresql. Org
> > > Subject: RE: [JDBC] access from java does not work in an applet!
> > >
> > >
> > > Applets sit in security 'sandbox'... you can only make
> connections back
> to
> > > the applet's originating server from the applet, so if your Postgres
> > > database is on the web server it'll be OK (barring firewalls etc.) but
> if
> > > its on another server the applet context will complain.
> > >
> > > -- snip --
> > >
> > > > -----Original Message-----
> > > > From: B.N.V. Raman [mailto:raman@myself.com]
> > > > Sent: Tuesday, 15 May 2001 10:19 PM
> > > > To: Pgsql-Jdbc@Postgresql. Org
> > > > Subject: [JDBC] access from java does not work in an applet!
> > > >
> > > >
> > > > Hello,
> > > >
> > > > Using JDBC, I was making a web access program for my postgres
> > > > database.
> > > > While the same code works in a Java program, when i convert
> > > > it into a Java
> > > > applet, i get a netscape security exception. What do i do?
> > > >
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01