JDBC driver wrapper for golang
Load and use JDBC Java database drivers from go. Without Java.
More may be supported, but these are the ones we package, test, and distribute.
For oracle, or if you want to build the native libraries yourself...
On osx run ./build-all.sh
to build for both mac and linux.
On linux, run individual scripts e.g. ./wrapper/scripts/wrap-oracle.sh
Import oracle, mssql, or postgresql driver.
import _ "github.com/identitii/gdbc/oracle"
Use gdbc-(oracle|mssql|postgresql)
as the driver name, and pass in the JDBC connection string (which is passed straight through to the driver)
pool, err = sql.Open("gdbc-oracle", "jdbc:oracle:thin:user/password@host:1521:sid")
When starting your application, it will look for the compiled driver shared library in the current directory (@executable_path) e.g. libgdbc-postgresql.dylib on mac, or libgdbc-postgresql.so on linux.
So either put the file in the current directory, or tell it where to find it like this...
DYLD_LIBRARY_PATH="path/to/the/shared/library" go run main.go
The one tiny benchmark so far has these GDBC drivers about 30% faster than the pure go drivers on mac, and about 30% slower than the pure go drivers on linux.
GraalVM to package the java driver as a native library, then CGO to communicate with it.
Because there are some databases that don't have or have incomplete or unsupported go drivers.
Initially started in order to get a fully featured oracle driver.
Also because it is fun.
We're a fintech startup based in Sydney, Australia.
Find this project interesting? Why not come work with us.
https://identitii.com/careers/
https://github.com/japettyjohn/go-jdbc, which itself is partly based on https://github.com/xoba/goutil
gopher logo by Mario Furmanczyk (mfurmanc on fiverr)