Question

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 ?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top