Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem connecting to Database

 
Ankit Nagpal
Ranch Hand
Posts: 47
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you're either calling the JDBC driver from inside an applet or an application that uses a security manager.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic