PhP with GAE and Google Cloud SQL

I am creating a web application using php to run on google app engine

. I want to use google cloud sql

to store data. I used a local MySQL instance during development. I added quercus

to my project and wrote some simple PHP code to fetch data from an existing mysql database. but i got below error when running 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 in php file,

mysql_connect(localhost,$username,$password);

      

what mistake? how can i fix this and get the data?

+3


source to share


1 answer


Cloud SQL is not offered over a socket connection like a regular MySQL database; it is available through a dedicated cloud SQL JDBC driver. As a result, you cannot use PHP built into the mysql

API; you have to use JDBC connector in Java as described here .



+4


source







All Articles