0

I could not find a link to this issue. I have searched for examples using MySQL and I am following the examples, but I still have this issue. I am using GWT and I have set up a MySQL server on another host. I want to get things working locally before deploying. I am able to see the driver as the Class.forName("com.mysql.jdbc.Driver") call is successful. The problem is getting the connection using DriverManager.getConnection(url, username, password). I know the credentials are correct. The exception I am getting is:

java.sql.SQLException: java.lang.NoClassDefFoundError: java.net.Socket is a restricted class. Please see the Google App Engine developer's guide for more details.

Based on other examples, I do not see what I am doing differently. Could this possibly be because the SQL server is on a different host? I have set the connection string using the IP address so I don't have to do a lookup:

private static final String url="jdbc:mysql://xx.xx.xx.xx:3306/dbname";

Yes, I have a valid IP where I have the XX's. This code works fine if I am not running in the GWT. Could this be because I am running the DB server on another host? Is this not allowed?

Help is appreciated

Marty

2
  • Marty, are you doing the JDBC/Hibernate/whatever calls somewhere on the server side? Be sure that you do not try to call from clientside. Maybe you could share more settings like your query-code... Commented Mar 3, 2012 at 18:42
  • No, I am simply trying to connect to the database to do a query. This should only require the Class.forName() call and a connect call. Since I posted this, I am now using DriverManager.registerDriver(newAppEngineDriver()); With this call I can access the online SQL database, but still get the socket error with the local database. You asked me to share the query code, I have not gotten there yet, I have to connect before I can do a query. Commented Mar 3, 2012 at 23:44

1 Answer 1

1

Your code is running on Google App Engine. You aren't allowed to use MySQL on GAE.

See Can I use a MySQL database with an App Engine application

Sign up to request clarification or add additional context in comments.

2 Comments

Under settings for App Engine there is a section on Google Cloud SQL. Under there you can choose to "Use MySQL instance" for development, which is what I am trying to do. Are you saying that for development you cannot use a local database?
I believe you have to use Google's specific MySQL. Note the requirement to 'create a Google cloud sql instance' section: developers.google.com/cloud-sql/docs/before_you_begin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.