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)/dbnamein the case of the "go-sql-driver/mysql" package.
1 Comments:
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...
Post a Comment
<< Home