2nd generation Google cloud SQL - App Engine
Asked Answered
T

2

5

Delighted to see that you have rolled out 2nd generation cloud SQL in Beta. However, I see that it is not available yet to GAE projects. Can you estimate when this link will be enabled please? We are making some big infrastructural changes in our fancy system necessitated by the slowness of Generation 1 SQL, but will stick with cloud SQL if the change is not far off.

Tackett answered 22/12, 2015 at 10:22 Comment(0)
W
2

You can now connect to second generation Google Cloud SQL instances from App Engine apps. The connection string is slightly different from first generation instances (docs).

  1. Open your SQL instance in the cloud console.
  2. Under properties copy the "Instance connection name". Note that this is different to the 'name' of your instance and will probably follow the format project:region:instance.
  3. It is normal for the UI to say "None" for authorized applications - you will still be able to connect from GAE. Note: the SQL instance and GAE app must be part of the same project.
    Update: Don't have to be in the same project, you need to grant access if they are not in the same project. Ref: https://cloud.google.com/sql/docs/dev-access#gaev1-csqlv2-access

screenshot

Example PHP connection code:

$con = "mysql:unix_socket=/cloudsql/CONNECTION_STRING_FROM_CONSOLE;dbname=some_db";
$this->db = new pdo($con, "root", "");
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Whitmore answered 18/4, 2016 at 4:11 Comment(0)
S
6

As of April 27, 2016 Second Generation connectivity to App Engine is supported.


OLD content:

The Cloud SQL team is actively working on adding App Engine support for Second Generation instances. Unfortunately I can't speak about specific dates, but we hope to make it available as soon as possible.

Slipstream answered 22/12, 2015 at 18:48 Comment(5)
Fair enough, will wait and see. Thanks and merry Christmas (apologies if anyone is reading this in 36 months or in high Summer : )Tackett
I know this was answered a lot of time ago, but it still confuses me. In this page: cloud.google.com/sql/docs/dev-access#gaev1-csqlv2 it says that we can connect to 2nd generation using standard GAE, while this page: cloud.google.com/appengine/docs/php/cloud-sql says we can't. So what's going on now? Is it already possible?Shevat
It is now officially supported, the announcement can be found here: groups.google.com/forum/#!topic/google-cloud-sql-announce/… The docs should be fixed now.Slipstream
It is still not supported yetGlove
? It's definitely supported.Slipstream
W
2

You can now connect to second generation Google Cloud SQL instances from App Engine apps. The connection string is slightly different from first generation instances (docs).

  1. Open your SQL instance in the cloud console.
  2. Under properties copy the "Instance connection name". Note that this is different to the 'name' of your instance and will probably follow the format project:region:instance.
  3. It is normal for the UI to say "None" for authorized applications - you will still be able to connect from GAE. Note: the SQL instance and GAE app must be part of the same project.
    Update: Don't have to be in the same project, you need to grant access if they are not in the same project. Ref: https://cloud.google.com/sql/docs/dev-access#gaev1-csqlv2-access

screenshot

Example PHP connection code:

$con = "mysql:unix_socket=/cloudsql/CONNECTION_STRING_FROM_CONSOLE;dbname=some_db";
$this->db = new pdo($con, "root", "");
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Whitmore answered 18/4, 2016 at 4:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.