1. Download MinGW (GCC compilation)---Win32
2. Download the latest OCI version, stored in C:\instantclient_12_1---Win32
3. Download OCI SDK latest version, store in C:\INSTANTCLIENT_11_2\SDK
4. Download the relevant source code.
Configure system Environment variables: Gopath
CD to Desktop\go directory
Execute go get github.com/wendal/go-oci8
5 Modify Coi8.go File
6. Download Pkg-config.exe and OCI8.PC
(Already stored in the Windows folder,)
Copy the Pkg-config.exe to the C:\mingw\bin\
Copy the oci8.pc to the C:\mingw\lib\pkg-config\
Note that OCI8.PC needs to be modified according to the OCI you downloaded. Here are the changes I made based on the OCI version I downloaded.
# Information for Pkg-config
Prefix=c:/instantclient_12_1
Exec_prefix=c:/instantclient_12_1
Libdir=${exec_prefix}
includedir=${prefix}/sdk/include/
Name:oci
Description:oracle Database Engine
version:12.1
Libs:-l${libdir}-loci
Libs.private:
Cflags:-i${includedir}
7. Modify the system environment variables,
Add to
Path= the original path; C:\instantclient_12_1; C:\MinGW\bin;
Pkg_config_path=c:\mingw\lib\pkg-config
8. Test:
CD%gopath%/src/github.com/wendal/go-oci8/example
Go Run oracle.go
Go to Oracle