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.

0 Comments:

Post a Comment

<< Home