Problem connecting to a Postgresql Database under Google GWT when APP Engine enabled

353 views
Skip to first unread message

Romeo Sanchez

unread,
Sep 10, 2009, 3:21:06 AM9/10/09
to google-we...@googlegroups.com
My problem is exactly the same as the one described at:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/244850e9cde1c733/da5c6bfeb61c8109?show_docid=da5c6bfeb61c8109

Basically, I get the following exception when trying to establish a connection to a Postgresql Database from a GWT project using app engine.

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)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:154)
........
.......
Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission myhost.com resolve)

Users in the google group thread suggest to uncheck the App Engine feature of the project. It seems this simple action fixes the problem. Unfortunately, my project requires the App Engine feature. I have verified the configuration files of the database server, and everything seems to be fine. I made a simpler project (which does not use GWT) to test the connection to the DB server and to query the database, and it works well. However, the same code does not work when it is invoked inside the server side of my GWT/APP engine application.

Is this a known bug of GWT? is App Engine conflicting with the DB Driver? I am using the latest DB driver for Postgresql.

If I split my project and I create a GWT module that connects to the DB server  (and does not use App Engine), and then inherit this module into the main project (the one using App Engine), would that solve my problem? If so, is there any other solution instead of doing this??

Thanks, I really appreciate any help from you guys. I am new on GWT/App Engine, and I really did not expect that connecting to Postgresql databases would be a problem.

RSN

Isaac Truett

unread,
Sep 15, 2009, 6:48:00 PM9/15/09
to google-we...@googlegroups.com
Basically, no. You can't do what you want to do. You can't connect to
your database from App Engine. That has nothing to do with GWT.

Romeo Sanchez

unread,
Sep 16, 2009, 2:52:12 PM9/16/09
to google-we...@googlegroups.com
Yes, I found out that is a security restriction from the App Engine, and not from the GWT Part. I still can connect from the App Engine to another web server that will query the database and send back data to my App Engine Application, or the other way around.

Thanks,
Reply all
Reply to author
Forward
0 new messages