简体   繁体   English

在Android中使用外部应用程序访问Google SQL数据库

[英]Accessing google sql database with external app in android

So I realize you cannot directly connect an app to the database directly. 因此,我意识到您无法直接将应用程序直接连接到数据库。 So what I did was create a GAE (google apps engine) backend with the external app which will access the database. 因此,我要做的就是使用将访问数据库的外部应用程序创建一个GAE(谷歌应用程序引擎)后端。

External app->backend->google cloud sql 外部应用程序->后端-> Google Cloud SQL

However I am confused as to where I put the address of the google SQL server in the GAE backend. 但是,我对将Google SQL服务器的地址放在GAE后端的位置感到困惑。 Would it go under enable google cloud sql which is under the properties for the app engine? 它会进入启用引擎属性下的Google Cloud sql吗?

This is with an already existing google cloud database. 这是与一个已经存在的谷歌云数据库。

You need to specify the address (and username and password) of the Cloud SQL instance when you create a connection: 创建连接时,您需要指定Cloud SQL实例的地址(以及用户名和密码):

Connection conn = DriverManager.getConnection( "jdbc:google:mysql://your-project-id:your-instance-name/database", "user", "password"); 连接conn = DriverManager.getConnection(“ jdbc:google:mysql:// your-project-id:your-instance-name / database”,“ user”,“ password”);

See https://developers.google.com/cloud-sql/docs/dev-access 请参阅https://developers.google.com/cloud-sql/docs/dev-access

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM