patterngoCritical
SSL is not enabled on the server
Viewed 0 times
enabledtheserversslnot
Problem
Trying to communicate with a postgres database with go, preparing the statement like this:
Throws the following error:
Any solution ?
I can add more information, if needed.
var stmt *sql.Stmt
var err error
stmt, err = db.Prepare(selectStatement)
if err != nil {
fmt.Printf("db.Prepare error: %v\n",err)
return err
}Throws the following error:
db.Prepare error: pq: SSL is not enabled on the serverAny solution ?
I can add more information, if needed.
Solution
You should establish DB connection without SSL encryption, like that:
db, err := sql.Open("postgres", "user=test password=test dbname=test sslmode=disable")Code Snippets
db, err := sql.Open("postgres", "user=test password=test dbname=test sslmode=disable")Context
Stack Overflow Q#21959148, score: 279
Revisions (0)
No revisions yet.