无法正确连接 db
liubq919 opened this issue · comments
官网的代码,
https://docs.taosdata.com/connector/go/
package main
import (
"database/sql"
"fmt"
_ "github.com/taosdata/driver-go/v3/taosSql"
)
func main() {
var taosUri = "root:taosdata@tcp(localhost:6030)/"
taos, err := sql.Open("taosSql", taosUri)
if err != nil {
fmt.Println("failed to connect TDengine, err:", err)
return
}
}
在测试中,taosUri被随便乱改成错误的地址,如 root:taosdata@tcp(localhost:60301)/, sql.Open("taosSql", taosUri)的返回的 err 一直是 nil 。
本地环境如下:
- TDengine-server-3.2.1.0-Linux-x64.deb
- github.com/taosdata/driver-go/v3 v3.5.1
- golang 1.21.1