aspose file tools*
The moose likes JDBC and the fly likes Problem connecting to Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem connecting to Database" Watch "Problem connecting to Database" New topic
Author

Problem connecting to Database

Ankit Nagpal
Ranch Hand

Joined: Sep 09, 2008
Posts: 47

Hi All,

While working on a JDBC code today, I got the following exception while creating a connection with Oracle:

java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1521 connect,resolve)

After looking through many forums and lots of googling, I found out the solution and added the following line in the .java.policy file:

grant {
permission java.net.SocketPermission "127.0.0.1:1521", "connect, resolve";
};

The code is working fine now, but just wanted to know why this problem started occurring after so many years of coding in JDBC since this wasn't the first time I was creating a connection and testing it.

I did not install/uninstall anything at my end.

Any answers??
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1824
    
    7

I guess you're either calling the JDBC driver from inside an applet or an application that uses a security manager.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem connecting to Database