Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Troubles with jdbc connection to postgres

843859Jul 27 2009 — edited Nov 20 2014
Hi everyone.

I'm trying to establish a jdbc connection to a postgre db on my server.

Here is my code, which is in a try-catch block.
Class.forName("org.postgresql.Driver")
String url = "jdbc:postgresql://DB_Start:5432/START";
Properties props = new Properties();
props.setProperty("user","usr_Start");
props.setProperty("password","***********");
props.setProperty("ssl","false");
Connection db = DriverManager.getConnection(url, props);
Even while debugging with eclipse, on the last line, I get the following error:

Error: org.postgresql.util.PSQLException: Your security policy has prevented the connection from being attempted. You probably need to grant the connect java.net.SocketPermission to the database server host and port that you wish to connect to.

I guess I have every needed permission and I surely use a user with the right grants; moreover, while trying a connection using a similar python code, I can easily get the connection. I googled a lot and i haven't found anything helpful. So I'm asking for some hints, do I set the wrong settings?
Do I miss anything?

Thank you for your help/attention
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2009
Added on Jul 27 2009
4 comments
432 views