[英]Authorizing App Engine Java Servlet to use Cloud SQL in eclipse
I have written a java servlet in app engine that i am trying to connect to a cloud sql, i am working in eclipse kepler on windows. 我在应用引擎中编写了一个Java Servlet,试图连接到云sql,我在Windows上的eclipse kepler中工作。 in the google cloud console i have authorized by app to access the database, they are both stored in the US.
在Google Cloud Console中,我已获得应用程序的授权访问数据库,它们都存储在美国。
To enable cloud sql for my app in eclipse i am going to google>app engine settings... 要在eclipse中为我的应用启用cloud sql,我要转到google>应用引擎设置...
i try to configure the cloud sql instance, i am using the appropriate instance name : and i have specified the correct database name username and password, i have also tried with a blank password, and both a blank password and user niether have worked. 我尝试配置云sql实例,我使用适当的实例名称:并且我指定了正确的数据库名称用户名和密码,我还尝试使用空密码,并且空密码和用户都可以使用。 additionally, i am using the same email account across my database and app engine and eclipse.
此外,我在数据库,应用程序引擎和Eclipse中使用相同的电子邮件帐户。 the error i receive is:
我收到的错误是:
Could not connect to Profile (<project>.GoogleCloudSQL.AppEngineInstance).
Error creating SQL Model Connection connection to
Profile(<project>.GoogleCloudSQL.AppEngineInstance). (Error: Not authorized to access
instance: <instance:database>)
Not authorized to access instance: <instance:database>
Error creating Google Cloud SQL Connection factory connection to Profile
(<project>.GoogleCloudSQL.AppEngineInstance). (Error: Not authorized to access
instance: <instance:database>)
Not authorized to access instance: <instance:database>
i then tried to test the database using the google_sql.sh script provided in the bin folder of the appengine sdk. 然后,我尝试使用appengine sdk的bin文件夹中提供的google_sql.sh脚本测试数据库。 i sent me to a url to get an authorization code, after entering the authorization code i was just given the script fails stating "the provided authorization grant is invalid, expired, revoked etc.".
我将我发送到url以获取授权码,输入授权码后,我只是被告知脚本失败,指出“所提供的授权授予无效,已过期,已撤销等。”。
i just want my app engine java servlet to be able to access my cloud sql database...does anyone have any advice? 我只希望我的应用程序引擎Java Servlet能够访问我的云SQL数据库...有人有什么建议吗? a solution?
一个解法? a similar problem?
类似的问题?
Please take a look at the following link for the recommended way to connect to your CloudSQL instance from dev purposes. 请查看以下链接,了解从开发目的连接到CloudSQL实例的推荐方法。 https://developers.google.com/appengine/docs/java/cloud-sql/#connect_and_post
https://developers.google.com/appengine/docs/java/cloud-sql/#connect_and_post
In short, just get an IP address for the CloudSQL instance using admin API or cloud console, authorize your network to access the CloudSQL instance through Cloud console, and point your application to it. 简而言之,只需使用管理API或云控制台获取CloudSQL实例的IP地址,授权您的网络通过Cloud控制台访问CloudSQL实例,然后将您的应用程序指向该实例即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.