0

I have a database instance on the Google Cloud SQL server. I want to query this database now through an Android app. I saw no option other than using a JDBC driver, as the Cloud SQL API's provided by Google don't have provisions for executing queries on the database.

The problem now is, to connect to the Cloud SQL database instance, I need this driver:

Class.forName("com.mysql.jdbc.GoogleDriver");

But when I run the app, the class is not found. Using Driver instead of GoogleDriver is of no use, as I am unable to connect to the remote instance (obviously). How do I access this database instance in my Android app now?

Parag Goel
  • 123
  • 2
  • 14
  • It's technically possible to get JDBC to work on Android but not recommended. A better solution is to create a web service around your database and access that from Android. See http://stackoverflow.com/questions/12233145/connecting-to-mysql-from-android-with-jdbc and http://stackoverflow.com/questions/7221620/android-jdbc-not-working-classnotfoundexception-on-driver/7221716#7221716 – Adam Apr 19 '15 at 23:34
  • 1
    Alright, thanks for this! How do I create a web service around the Cloud SQL instance? – Parag Goel Apr 20 '15 at 00:23
  • This is where it gets out of scope for a StackOverflow question. If you want to use App Engine for your backend, a good tutorial is at https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial. – Adam Apr 27 '15 at 00:00
  • I have the same question as @ParagGoel ... perhaps it's not really out of scope for SO –  Jun 25 '15 at 03:26

0 Answers0