I'm working on an application to run on Google app engine. Normally, I would have to enable billing/pay if am using Google Cloud SQL. So for a start, I decided to connect remotely to a mysql database on another server. It works perfectly offline but after deploying my app it didn't work. Clearly, GAE doesn't support remote connections ... Is there another way to go around this ? tunneling ?
NB: Using an HTTP API to return info from my database ... would require more programing efforts.
Unfortunately, App Engine does not support External calls:
An App Engine application cannot:
write to the filesystem. PHP applications can use Google Cloud Storage for storing persistent files. Reading from the filesystem is allowed, and all application files uploaded with the application are available.
open a socket or access another host directly. An application can use the App Engine URL fetch service to make HTTP and HTTPS requests to other hosts on ports 80 and 443, respectively.
respond slowly. A web request to an application must be handled within a few seconds. Processes that take a very long time to respond are terminated to avoid overloading the web server.
make other kinds of system calls.
In 1.8.8 we made it possible to use remote sockets from PHP.
You'll need to make sure your application has billing enabled for remote sockets to be available. Once you do that you should be able to connect to a remote MySQL database from your app engine app.
What Stuart Langley said also applies to Python.
You must have bill enabled to use remote sockets. But from my experiment, the MySQLdb included with the App Engine runtime seems not working with external MySQL database.
You can use the pure python library mysql-connector-python provided by Oracle instead. But be warned, the latency is high (if you open a new connection per request the total latency can be 5 seconds plus). Maybe because the remote socket is not a native implementation but rather a proxy or service under the hook.
I have an external MySQL database to which I'm connecting from Google App Engine. I have written this tutorial. I hope this helps you and others here. Using an external database with Google App Engine