无法从 GAE 连接到 Google Cloud 2nd Gen

Can't connect to Google Cloud 2nd Gen from GAE

我将我的云 SQL V1 数据库备份到一个存储桶并恢复到一个新的第二代实例。通过控制台连接工作正常。我可以 select,查看 procs 等。从我的 Java GAE 应用程序连接到它不会。 GAE 应用程序和云 SQL 数据库在同一个项目中。

我在日志中得到这些值:

GAE 日志:

java.sql.SQLInvalidAuthorizationSpecException: Not authorized to access instance: xxxx

SQL 日志:

[Warning] User 'root'@'%' was assigned access 0x1fffffff but was allowed to have only 0x1fff7dff.

有什么建议吗?

确保您的 JDBC URL 使用 jdbc:google:mysql:// 前缀而不是 old/deprecated jdbc:google:rdbms:// 前缀。

虽然 jdbc:google:rdbms:// 继续适用于第一代实例,但在连接到第二代实例时将不起作用。 jdbc:google:mysql:// 两者都适用。