You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my password having special characters like "#" and "|", when I'm trying to connect using perl it connecting successfully but golang is giving error : netlib: unexpected EOF while reading message
here is my code snippet
can you please help what is wrong in this, do i need to encode password into something?
`import (
"database/sql"
_ "github.com/thda/tds"
)
my password having special characters like "#" and "|", when I'm trying to connect using perl it connecting successfully but golang is giving error : netlib: unexpected EOF while reading message
here is my code snippet
can you please help what is wrong in this, do i need to encode password into something?
`import (
"database/sql"
_ "github.com/thda/tds"
)
func getConn(cred map[string]string) (c *sql.DB) {
Name := cred["NAME"]
Pass := cred["PASS"] // 6#A(co&k|31V
Server := cred["SERVER"]
User := cred["USER"]
Port := cred["PORT"]
// dbConn := fmt.Sprintf("dbname=%s host=%s port=%s user=%s password=%s", Name, Server, Port, User, Pass)
cnxStr := "tds://" + url.QueryEscape(User) + ":" + url.QueryEscape(Pass) + "@" + Server + ":" + Port + "/" + Name + "?charset=utf8"
conn, err := sql.Open("tds", cnxStr)
if err != nil {
fmt.Println("Open Connection failed..", err)
panic(err)
}
conn.SetConnMaxLifetime(time.Minute * 4)
conn.SetMaxIdleConns(0)
defer conn.Close()
if err := conn.Ping(); err != nil {
log.Println("sql.Ping failed:", err.Error())
return nil
}
}`
The text was updated successfully, but these errors were encountered: