我是 go lang 開發(fā)的初學(xué)者,我嘗試從 go 服務(wù)器連接云 oracle 數(shù)據(jù)庫(使用 'github.com/godror/godror' 包)。我安裝了 Oracle 即時客戶端并設(shè)置了環(huán)境路徑。Go 服務(wù)器正在運行并且能夠建立連接和查詢。但是當(dāng)我構(gòu)建一個生產(chǎn)應(yīng)用程序時出現(xiàn)了這些錯誤。命令:env GOOS=linux GOARCH=amd64 go build -o odb db_main.go../github.com/godror/godror/orahlp.go:452:53: undefined: VersionInfo../github.com/godror/godror/orahlp.go:461:53: undefined: VersionInfo../github.com/godror/godror/orahlp.go:479:19: undefined: VersionInfo../github.com/godror/godror/orahlp.go:480:19: undefined: VersionInfo../github.com/godror/godror/orahlp.go:481:30: undefined: ObjectType../github.com/godror/godror/orahlp.go:482:31: undefined: Event../github.com/godror/godror/orahlp.go:482:42: undefined: SubscriptionOption../github.com/godror/godror/orahlp.go:482:64: undefined: Subscription../github.com/godror/godror/orahlp.go:483:10: undefined: StartupMode../github.com/godror/godror/orahlp.go:484:11: undefined: ShutdownMode../github.com/godror/godror/orahlp.go:484:11: too many errors```My server code(db_main.go)```package mainimport ( "database/sql" "encoding/json" "fmt" "log" "net/http" "time"_ "github.com/godror/godror")// VersionInfo,ObjectType,Event,SubscriptionOption,Subscription,StartupMode,ShutdownModevar db *sql.DBfunc main() { var err error db, err = sql.Open("godror", "xyz/abc@13.43.11.8:1521/sampledb") if err != nil { log.Println("Error") fmt.Println(err) return } defer db.Close() port := ":8000" http.HandleFunc("/insert", InsertData) http.HandleFunc("/list", GetList) log.Println("Tranzo-Shahi Oracle DB running in ", port) httpErr := http.ListenAndServe(port, nil) if httpErr != nil { log.Println("Tranzo-Shahi Oracle DB Error: ", httpErr.Error()) }}
無法使用 oracle db 在 golang 中構(gòu)建應(yīng)用程序
呼喚遠(yuǎn)方
2022-05-23 16:29:02