I'm trying to connect to an external MySQL database using GAE-Standard 
Environment (Golang).
I can't get it to work.

The documentation for GAE-Standard Environment definitely says it is 
possible. For obvious reasons, they are hiding how to do it!

https://cloud.google.com/appengine/docs/go/using-third-party-databases

I use Go  but also understand PHP.

my attempt:

I don't seem to be able to connect to an external MySQL database even using 
socket API.

Stuart Langley from GAE-PHP says it is possible: 
http://stackoverflow.com/questions/26322445/connecting-external-mysql-to-google-app-engine

https://github.com/go-sql-driver/mysql/issues/457

When I try to connect to an external database the 'normal way' without 
appengine/socket I get this error:

error: dial tcp 173.388.532.444:3306: socket: operation not permitted

When I try connecting like this (abridged):

"google.golang.org/appengine"
"github.com/go-sql-driver/mysql"
"google.golang.org/appengine/socket"

dial := func(addr string) (net.Conn, error) {
        return socket.Dial(appengine.NewContext(r), "tcp", addr)
    }

mysql.RegisterDial("external", dial)

and change my dataSourceName = something like: 
"id:password@*external*(your-amazonaws-uri.com:3306)/dbname" 
I get this error:

error: API error 5 (remote_socket: PERMISSION_DENIED): connection to (2, 
173.388.532.444:3306,6) denied due to policy

My app is a paid google app engine-standard environment app hence sockets 
are available.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/98994e4a-197d-48e5-a82f-187a6665b93e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to