This is a creation in Article, where the information may have evolved or changed.
Go-oci8 Download Address and description address: Https://github.com/wendal/go-oci
GO-OCI8 Official description
Install the latest version of Git and set the git command to be called directly from the command line
This step is a little bit more
2.1 下载OCI最新版,存放于C:\instantclient_11_22.2 下载OCI SDK最新版,存放于C:\instantclient_11_2\sdk2.3 下载MinGW最新版,安装在C:\mingw2.4 下载pkg-config.exe和oci8.pc (已经存放在windows文件夹下)2.5 将pkg-config.exe复制到C:\mingw\bin\下2.6 将oci8.pc复制到C:\mingw\lib\pkg-config\下
Modify system environment variables, add
PATH=原有PATH;C:\instantclient_11_2;C:\mingw\bin; PKG_CONFIG_PATH=C:\mingw\lib\pkg-config
Performgo get github.com/wendal/go-oci8
The second download, can be downloaded here, where the environment has been configured
If this step is not in go-oci8 official download, but and I then, step by step to the various software official website to download, then pay attention to
After downloading and installing, need to modify oci8.pc;
# Package Information for pkg-config prefix=C:/instantclient_11_2 exec_prefix=C:/instantclient_11_2 libdir=${exec_prefix} includedir=${prefix}/sdk/include/ Name: OCI Description: Oracle database engine Version: 11.2 Libs: -L${libdir} -loci Libs.private: Cflags: -I${includedir}
需要把prefix、exec_prefix指向你的安装目录
This package is not supported by win x64, I have not tested the 64-bit version of the installation
This timego get github.com/wendal/go-oci
-
If you appear like me
C:\Documents and Settings\administrator>go get github.com/wendal/ GO-OCI8 # github.com/wendal/go-oci8 C:\gopath\src\github.com\wendal\go-oci8\oci8.go:119:cannot use (**C.struct_OCIS erver) (unsafe. Pointer (&CONN.SVC)) (type **c.struct_ociserver) as type **c.struct _ocisvcctx in argument to _cfunc_ocilogon C:\Go Path\src\github.com\wendal\go-oci8\oci8.go:136:cannot Use (*c.struct_ociserver) (c.svc) (type *C.struct_OCIServer) As type *c.struct_ocisvcctx in argument to _cfunc_ocilogoff c:\gopath\src\github.com\wendal\go-oci8\oci8.go:263: Cannot use (*c.struct_ociserver) (s.c.svc) (type *c.struct_ociserver) as type *c.struct_ocisvcctx on argument to _cfunc_oc Istmtexecute c:\gopath\src\github.com\wendal\go-oci8\oci8.go:383:cannot Use (*c.struct_ociserver) (S.C.SVC) (type * C.struct_ociserver) as type *c.struct_ocisvcctx in argument to _cfunc_ocistmtexecute
This error indicates that you installed the OCI version and Go-oci8 inconsistent, this time to find the %GOPATH%\src\github.com\wendal\go-oci8\oci8.go
file
There are 4 places to change
(**C.OCIServer)(unsafe.Pointer(&conn.svc)),改为(**C.OCISvcCtx)(unsafe.Pointer(&conn.svc)),
(*C.OCIServer)(c.svc),改为(*C.OCISvcCtx)(c.svc),
(*C.OCIServer)(c.svc),改为(*C.OCISvcCtx)(c.svc),
(*C.OCIServer)(c.svc),改为(*C.OCISvcCtx)(c.svc),
or replace the Ociserver directly with the ocisvcctx. Re-execute
go get github.com/wendal/go-oci
Fix it.