I'm trying to use the odbc driver and I'm getting errors:
.\main.go:5: imported and not used: "code.google.com/p/odbc/api"
.\main.go:72: undefined: Driver
.\main.go:76: undefined: Driver
I tried to work with another driver: go get github.com/denisenkom/go-mssqldb
but ran unto the same type of problem.
That's why I suspect I didn't set up the environment right but unable to find the issue.
My environment:
set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Go\Projects
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set TERM=dumb
set CC=gcc
set GOGCCFLAGS=-g -O2 -m64 -mthreads
set CXX=g++
set CGO_ENABLED=1
I installed odbc using go get code.google.com/p/odbc
Ran test and it finished fine:C:\Go\Projects\src\code.google.com\p\odbc>go test -mssrv=.\sqlexp -v -run=MS
...
--- PASS: TestMSSQLUTF16ToUTF8 (0.00 seconds)
=== RUN TestMSSQLExecStoredProcedure
--- PASS: TestMSSQLExecStoredProcedure (0.01 seconds)
PASS
ok code.google.com/p/odbc 0.574s
My Code: (copied from mssql_test.go):
package main
import (
"code.google.com/p/odbc/api"
"database/sql"
"flag"
"fmt"
"os"
"runtime"
"testing"
"time"
)
func mssqlConnect() (db *sql.DB, stmtCount int, err error) {
.........
return db, db.Driver().(*Driver).Stats.StmtCount, nil
}
func closeDB(t *testing.T, db *sql.DB, shouldStmtCount, ignoreIfStmtCount int) {
s := db.Driver().(*Driver).Stats
......