Обсуждение: Connect Socket problem

Поиск
Список
Период
Сортировка

Connect Socket problem

От
"Rodrigo F. Baroni"
Дата:
Hello all,

    Please, could someone help me ?!

    I did a applet, using a jdbc driver to connect
with postgres 7.3.1 in a RedHat linux 8.0. When I run
it from my own machine to connect with the postgres in
my  PC it works fine, but when I run the applet to
connect to a remote server postgres, the driver
returns the follow error (got at exception) :

" Something unusual has occured to cause the driver to
fail. Please report this exception: Exception:
java.security.AccessControlException: access denied
(java.net.SocketPermission XXX.XXX.XXX.XXX:5432
connect, resolve) "

  And the Sack Trace follows:

"java.security.AccessControlContext.checkPermission(AccesscontrolContex.java:270)
.... "


   Does anybody have any suggestion ?!!


Thanks a lot
Rodrigo F Baroni

_______________________________________________________________________
Yahoo! Mail
Mais espaço, mais segurança e gratuito: caixa postal de 6MB, antivírus, proteção contra spam.
http://br.mail.yahoo.com/

Re: Connect Socket problem

От
Paul Thomas
Дата:
On 19/06/2003 06:44 Rodrigo F. Baroni wrote:
> Hello all,
>
>     Please, could someone help me ?!
>
>     I did a applet, using a jdbc driver to connect
> with postgres 7.3.1 in a RedHat linux 8.0. When I run
> it from my own machine to connect with the postgres in
> my  PC it works fine, but when I run the applet to
> connect to a remote server postgres, the driver
> returns the follow error (got at exception) :
>
> " Something unusual has occured to cause the driver to
> fail. Please report this exception: Exception:
> java.security.AccessControlException: access denied
> (java.net.SocketPermission XXX.XXX.XXX.XXX:5432
> connect, resolve) "
>
>   And the Sack Trace follows:
>
> "java.security.AccessControlContext.checkPermission(AccesscontrolContex.java:270)
> .... "
>
>
>    Does anybody have any suggestion ?!!

Its the Java security manager. By default, this will only allow an applet
to connect to its web server. You must either run postgres on the same
machine as the web server or edit the jre/lib/security/java.policy file on
your client PC to allow the applet to connect to your postgres machine.
There are ecellent tutorials on applets and security on Sun's Java web
site (http://java.sun.com).

HTH


--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

Re: Connect Socket problem

От
"David Wall"
Дата:
I'm not an applet kind of person, so I'm not sure how you work around it,
but this is simply an exception thrown because the JVM has a security
manager and your applet has not been configured to allow the socket
permissions in it's related "java.policy" file.  You'll need an entry for
your applet that grants that permission with an entry like:

permission java.net.SocketPermission "xxx.xxx.xxx.xxx:5432",
"connect,resolve";

Hope this helps as you'll need to research how to set this for an applet.

David


----- Original Message -----
From: "Rodrigo F. Baroni" <rodrigobaroni@yahoo.com.br>
To: <pgsql-jdbc@postgresql.org>
Sent: Wednesday, June 18, 2003 10:44 PM
Subject: [JDBC] Connect Socket problem


> Hello all,
>
>     Please, could someone help me ?!
>
>     I did a applet, using a jdbc driver to connect
> with postgres 7.3.1 in a RedHat linux 8.0. When I run
> it from my own machine to connect with the postgres in
> my  PC it works fine, but when I run the applet to
> connect to a remote server postgres, the driver
> returns the follow error (got at exception) :
>
> " Something unusual has occured to cause the driver to
> fail. Please report this exception: Exception:
> java.security.AccessControlException: access denied
> (java.net.SocketPermission XXX.XXX.XXX.XXX:5432
> connect, resolve) "
>
>   And the Sack Trace follows:
>
>
"java.security.AccessControlContext.checkPermission(AccesscontrolContex.java
:270)
> .... "
>
>
>    Does anybody have any suggestion ?!!
>
>
> Thanks a lot
> Rodrigo F Baroni
>
> _______________________________________________________________________
> Yahoo! Mail
> Mais espaço, mais segurança e gratuito: caixa postal de 6MB, antivírus,
proteção contra spam.
> http://br.mail.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster