You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Moi spécial <jp...@club-internet.fr> on 2002/06/11 23:22:13 UTC

Problem with Postgresql jdbc connection

Hello,

I am trying to use a jdbc connection to Postgresql and I have some problems
with the security manager (?).
Every access to the database gives me an abort of the transaction with a 
stack trace :

----------------------------------------------------------------------------------------------------------------------------------
Apache Tomcat/4.0.3
ACCESS Erreur connection : ==Something unusual has occured to cause the 
driver to fail. Please report this exception: Exception: 
java.security.AccessControlException: access denied 
(java.net.SocketPermission localhost resolve)
Stack Trace:

java.security.AccessControlException: access denied 
(java.net.SocketPermission localhost resolve)
        at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:272) 
       at 
java.security.AccessController.checkPermission(AccessController.java:399)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
        at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
        at java.net.InetAddress.getAllByName0(InetAddress.java:559)
        at java.net.InetAddress.getAllByName0(InetAddress.java:540)
        at java.net.InetAddress.getByName(InetAddress.java:449)
        at java.net.Socket.<init>(Socket.java:100)
        at org.postgresql.PG_Stream.<init>(PG_Stream.java:41)
        at org.postgresql.Connection.openConnection(Connection.java:134)
        at org.postgresql.Driver.connect(Driver.java:149)
        at java.sql.DriverManager.getConnection(DriverManager.java:517)
        at java.sql.DriverManager.getConnection(DriverManager.java:177)
        at database.access.<init>(access.java:46)
------------------------------------------------------------------------------------------------------------------------------------------

The line 46 in my class (database.access) looks like :

    44       try
     45       {
     46         db = DriverManager.getConnection(url, username, password);
     47       } catch (SQLException se)
     48         { ret = 1;
     49           System.out.println("ACCESS Erreur connection : " + "=="  
+se+ "==");
     50           return;
     51         }
     52     }

That class is OK when called through a "terminal screen", the connection is OK
and all wnet well.

I look at the "security" properties in the "catalina.policy" file, but I 
can't find the good value for the parameters, even if I give all permissions 
to the  jdbc.jar ..... with :
 
 grant codeBase "file:/var/lib/tomcat4/webapps/myapps/WEB-INF/lib/pgjdbc2.jar"
 {   permission java.security.AllPermission;
 };

I can't find the right "codebase" to apply the "grant" ?????. 

Any help is wanted ...

Regards

JP Pozzi

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>