Error "SSL is not enabled on the server" when connecting to PostgreSQL from Go
Hello everyone! I'm new to Go and trying to connect to PostgreSQL running on a cloud server. I'm using the `lib/pq` driver. The server requires an SSL connection, but I can't configure it.
Here's my code:
```go
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
)
func main() {
connStr := "host=mycloudserver.com port=5432 user=myuser password=mypass dbname=mydb sslmode=disable"
db, err := sql.Open("postgres", connStr)
if err != nil {
panic(err)
}
defer db.Close()
err = db.Ping()
if err != nil {
fmt.Println("Connection error:", err)
} else {
fmt.Println("Connection successful!")
}
}
```
When I run it, I get the error: `pq: SSL is not enabled on the server`. I understand that