3

I'm creating a web app using php to run on google app engine. i wish to use google cloud sql to store data. i used a Local MySQL Instance During Development. i have added quercus to my project and wrote simple php code to retrieve data from existing mysql database. but i got below error when i run my php file.

D:\workspace\PHPStore\war\info.php:6: Warning: A link to the server could not be established. url=jdbc:mysql://localhost:3306/?characterEncoding=ISO8859_1 driver=com.mysql.jdbc.Driver com.caucho.quercus.QuercusModuleException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver [mysql_connect] Unable to select database

line 6 on php file is,

mysql_connect(localhost,$username,$password);

what is the error ? how could i correct this and retrieve data ?

Bishan
  • 15,211
  • 52
  • 164
  • 258
  • Google App Engine allows PHP?. I thought they only allowed to run Java or Python. – Lobo Apr 09 '12 at 08:25
  • are you sure `mysql` is on the same machine ??? – Baba Apr 09 '12 at 08:55
  • 2
    @Lobo we can not run php on Google App Engine directly. but we can run php on Google App Engine with quercus.(http://quercus.caucho.com/) – Bishan Apr 09 '12 at 09:05
  • @Baba yes. mysql is on the same machine. – Bishan Apr 09 '12 at 09:06
  • The error indicates that you can not select the database. Looks like it connects to the server fine. Perhaps the user that connects to the database does not have permissions or the user does not exist. – Lobo Apr 09 '12 at 09:10
  • @Lobo user is exist and i have grant all permissions and privileges to user. – Bishan Apr 09 '12 at 09:13
  • I think this might be the answer http://wordpress-on-quercus-2.appspot.com/?p=4#more-4 View "V. EXECUTING SQL QUERIES ON GAE" They are really smart people. Wish this helpful. Good luck! – Nevin Chen Apr 07 '13 at 04:57

1 Answers1

4

Cloud SQL isn't offered over a socket connection like a regular MySQL database; it's accessible via a cloud SQL specific JDBC driver. As a result, you can't use PHP's built in mysql API; you have to use the JDBC connector in Java, as described here.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198