mattn/go-oci8

exit status 0xc0000135, golang with windows

ducnpdev opened this issue · 3 comments

I have one issue, when start golang with windows:

i download cliet: https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html

  • where pkg-config:
    C:\ProgramData\chocolatey\bin\pkg-config.exe

  • path of file oci8.pc
    C:\ProgramData\chocolatey\bin\oci8.pc

  • oci8.oc:
    prefix=D:/app/instantclient-sdk-windows-12.2/instantclient_12_2
    exec_prefix=${prefix}
    libdir=D:/app/instantclient-sdk-windows-12.2/instantclient_12_2/sdk/lib/msvc
    includedir=D:/app/instantclient-sdk-windows-12.2/instantclient_12_2/sdk/include
    glib_genmarshal=glib-genmarshal
    gobject_query=gobject-query
    glib_mkenums=glib-mkenums
    Name: oci8
    Description: oci8 library
    Libs: -L${libdir} -loci
    Cflags: -I${includedir}
    Version: 12.12

  • pkg-config --cflags --libs -- oci8:
    -ID:/app/instantclient-sdk-windows-12.2/instantclient_12_2/sdk/include -LD:/app/instantclient-sdk-windows-12.2/instantclient_12_2/sdk/lib/msvc -loci

  • go version:
    go version go1.18.6 windows/amd64

my-code:
package main

import (
"database/sql"
"fmt"

_ "github.com/mattn/go-oci8"

)

func main() {
fmt.Println("func main")
connectionString := "oracle://" + "user" + ":" + "pass" + "@" + "0.0.0.0" + ":" + "1521" + "/" + "database"
db, err := sql.Open("oci8", connectionString)
if err != nil {
panic(err)
}
err = db.Ping()
if err != nil {
panic(err)
}
fmt.Println("oracle connect successfully")
}

after run in cmd: go run main.go, I see error:
exit status 0xc0000135,

mattn commented

Probably, you need to add path to the DLLs provided from Oracle Client into your %PATH%

I have the same problem, how did you solve it?

you can try pkg-config --cflags oci8 and see the output, if there is error reported by pop-up window which content likes "libglib-2.0-0.dll not exist", just copy one into mingw64\bin, then have a try