Monday, April 30, 2012

org.postgresql.util.PSQLException

Hi,

I am getting error when I am trying to connect to Postgresql database
from my program. The code I have written is on server side. And I have
added postgres.sql.jar in run configurations build path. I am not able
to figure out the solution. I have tried using other java classes like
BaseDatasource, etc but getting errors there too.

Program -

public Connection makeDatabaseConn(){
try{

Class.forName("org.postgresql.Driver");

String url = "jdbc:postgresql://
localhost:5432/my_db";
con = DriverManager.getConnection(url,
"postgres",
"password");
con.setAutoCommit(true);

}catch( Exception e )
{
e.printStackTrace();
}

return con;

}

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.
at org.postgresql.Driver.connect(Driver.java:282)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment