The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Thursday, March 17, 2016

Connecting to CloudSql with App Engine and Golang

Things that were not immediately obvious.

What wasn't immediately clear was that app engine was not able to connect to the 'new' Managed VM version of Cloud Sql.

In order to use app engine and connect to cloud sql you need to import the following 2 packages as side effects, as well as the "database/sql" package:

import (
 "database/sql"
 _ "appengine/cloudsql"
 _ "github.com/go-sql-driver/mysql"
)

NOTE: please use access control; if you set the root password for the localhost domain, your app engine instance will not be able to connect with standard cloud sql DSN, such as:

user@cloudsql(project-id:instance-name)/dbname
in the case of the "go-sql-driver/mysql" package.

1 Comments:

Blogger Unknown said...

Been banging my head against the keyboard for the better part of half a day. Imported everything, played around with countless permutations of that DSN to no avail. Google doesn't want me to succeed...

12:39 AM  

Post a Comment

<< Home