db
db copied to clipboard
does it support mssql with odbc connection?
In real sence I need odbc connection for mssql,but I found it's documents with url method only. does it support for odbc connection?
Not directly, but the mssql.Open function expects an argument of type db.ConnectionURL so you can provide your own connection string by providing any struct that satisfies db.ConnectionURL:
type odbcConnectionURL struct {
dsn string
}
func (odbc odbcConnectionURL) String() string {
return odbc.dsn
}
settings := odbcConnectionURL{"odbc:server=localhost;user id=sa;database=master;connection timeout=30"}
conn, err := mssql.Open(settings)
...
Does this work for you?
It was work, and I have tried ado Connection with options: {"encrypt": "disable"},It was work too. Thanks a lot. ^_^