Member-only story
Connecting a Go application to Oracle Database
In this article, I want to walk you through connecting a Go app to a local Oracle Database and to Autonomous Database on OCI (both on-prem and autonomous, with and without Oracle Client libraries).
That’s sounds like a lot, but I promise it’s easier than it sounds.
One application uses only package go_ora and does not require the Oracle Instant Client library. The other uses package godror (aka goracle) and requires the Oracle Instant Client. For connecting to the local database both applications only use simple connection details — user, password, host, port, service name — but no wallet). For the connection to the Autonomous Database both applications use Oracle Wallet (to at least provide the certificate used for securing the transport to the database).
I had been struggling a bit with this one: how to connect from a Go application to an Oracle Database — both a locally running database as well as an Autonomous Database Instance running on Oracle Cloud. Ideally, my application does not require Oracle Client Libraries to be installed in order to contact a database as that rather complicates the installation process and general portability of the Go application. On one hand this is a smooth single binary that can run without additional requirement on a runtime configuration and JRE-like installation and then one…