How to connect GoLang to Oracle Database 12c in Windows - Go Oracle Database connectivity - godror
In this video we are going to see how to connect GoLang with Oracle Database 12c using Go Driver for Oracle DB (godror).
Requirements: Go 1.20, Oracle Database 12c EE running (localhost) on windows and We need C/C++ compiler to be installed in our machine.
Here we are using latest mingw compiler. godror is cgo package. If you want to build your app using godror, you need gcc (a C compiler).
1. Add the Go and MingW compiler's bin directory to PATH variable.
2. Go to the directory where you have Golang source files in command prompt.
3. create a Go module (go mod init oracle12c).
4. download the godror oracle driver (go get github.com/godror/godror).
5. Run the Go Program that connects to Oracle Database.
Important Note: MingW compiler is mandatory here and Oracle Instant Client is not needed for this program which I have shown.
MingW Compiler can be downloaded from https://github.com/niXman/mingw-builds-binaries/releases
Go Driver for oracle can be downloaded from https://github.com/godror/godror
Golang can be obtained from https://go.dev/dl/
#go #goprogramming #golang #golangtutorial #golanguage #golangoracle #godror #golangwindows #gowindows