服务器上未启用SSL [英] SSL is not enabled on the server
本文介绍了服务器上未启用SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用go与Postgres数据库进行通信,并准备如下语句:
Trying to communicate with a postgres database with go, preparing the statement like this:
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
}
引发以下错误:
db.Prepare error: pq: SSL is not enabled on the server
任何解决方案吗?
如果需要,我可以添加更多信息.
I can add more information, if needed.
推荐答案
您应建立没有SSL加密的数据库连接,如下所示:
You should establish DB connection without SSL encryption, like that:
db, err := sql.Open("postgres", "user=test password=test dbname=test sslmode=disable")
这篇关于服务器上未启用SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文