Tag Archives: GAE

How do i connect to development/local MySQL in Google App Engine (GAE) application?

Place mysql-connector jdbc jar here:

<googleAppEngineSDKBundle>\<appEngineSDK>\lib\impl\

You can find location of your appEngineSDKBundle by: Project>Properties>Google>SDK>Configure

Configure Cloud/Local MySQL

Project>Properties> Google>  App Engine>

Enable (checkbox yes) Google Cloud SQL

App Engine SQL Instance – put any junk values here even if u don’t have Cloud SQL yet.

Select Radio button Use MySQL Instance, and hit configure link to configure.

Click OK and close

The Code

import com.google.cloud.sql.jdbc.Connection; //This is your Connection Class.

Class.forName(“com.mysql.jdbc.Driver”);

conn = (Connection) DriverManager.getConnection(“jdbc:google:rdbms://localhost:3306/root”);

Even though your code seems to point to Cloud, while running locally based on all the above configuration, it will actually point to your local MySQL instance.

See here: http://stackoverflow.com/questions/8952696/java-google-app-engine-and-google-cloud-sql-running-on-local-dev-server (Mark Scheel’s explanation)