为什么我一直收到"找不到合适的驱动程序"错误?

Rob*_*t D 2 google-app-engine jdbc google-cloud-sql

当我尝试从GAE连接到Cloud SQL时,我收到此错误:

"没有为jdbc找到合适的驱动程序:google:mysql:// parasql-app:inst101/db1384221549822"

我的代码看起来像这样:

Class.forName("com.mysql.jdbc.GoogleDriver");
Connection con = DriverManager.getConnection("jdbc:google:mysql://" + this.instance_name + "/" + this.database_name);
Run Code Online (Sandbox Code Playgroud)

连接旧版"jdbc:google:rdbms://"连接字符串没有问题.

我怎样才能解决这个问题?

小智 5

您需要启用mysql connector/j.请按照以下链接中的说明进行操作.

https://developers.google.com/appengine/docs/java/cloud-sql/#enable_connector_j