는, 순수 이동 패키지 GitHub의에서 데이터베이스 드라이버 목록 SQL database drivers에서 Microsoft SQL Server 관련 드라이버가 https://github.com/denisenkom/go-mssqldb
go-mssqldb
을 시도하면 mssql
에 직접 연결할 수 있습니다.
// the user needs to be setup in SQL Server as an SQL Server user.
// see create login and the create user SQL commands as well as the
// SQL Server Management Studio documentation to turn on Hybrid Authentication
// which allows both Windows Authentication and SQL Server Authentication.
// also need to grant to the user the proper access permissions.
// also need to enable TCP protocol in SQL Server Configuration Manager.
condb, errdb := sql.Open("mssql", "server=localhost;user id=gouser;password=g0us3r;")
if errdb != nil {
fmt.Println(" Error open db:", errdb.Error())
}
defer condb.Close()
내가 그것을 사용하고, 그것이 지금은 괜찮습니다 :
import (
"fmt"
"log"
"database/sql"
_ "github.com/denisenkom/go-mssqldb" // the underscore indicates the package is used
)
가 sql.Open()
은 다음과 같습니다처럼
import
는 볼 수 있었다.
https://code.google.com/p/odbc – alex
Alex, 해당 드라이버를 사용하여 sql.Open() 호출의 예를 제공 할 수 있습니까? DSN을 사용해야하거나 연결 문자열을 지정할 수 있습니까? 감사. – slachterman
https://code.google.com/p/odbc/source/browse/mssql_test.go#56 – alex