samedi 1 juillet 2017

Postgres aws with Golang

I am using Golang to connect to a Postgres DB instance. When the code below is executed from ec2 instance,the err is not nil after sql.open(). How ever when I run db.Ping() is doesn't do anything. The code after db.ping() doesn't seem to be executed. After a while I get getsockopt: connection timed out on the terminal window. What can be the problem?

db, err := sql.Open("postgres", "postgres://username:mypassword@xxxxxx.xxxxxxxxxx.xx-xxxx-x.xxx.xxxxxxxxx.xxx/postgres?sslmode=disable")



    if err != nil {
        check(err)
        panic(err)
    }

    err = db.Ping()

    if err != nil {
        check(err)
        panic(err)
    }




Aucun commentaire:

Enregistrer un commentaire