Oracle

235 views
Skip to first unread message

san...@banerji.in

unread,
Nov 18, 2017, 11:09:46 AM11/18/17
to golang-nuts
First, let me thank the person who has written the Oracle (oci8) package for Go (preferred over the other Oracle package).


However, it seems difficult to install, on Windows at least.  Google-ing for help did not give a solution.  I am less than 7 hours old in Go, so perhaps after soldering on, I will eventually get to install it.

If Go would like to entrench itself even more, perhaps appealing to corporate users would be a good idea.  This means that installing linkages to databases used by corporates, such as Oracle, should be a breeze.


Next, looking at the functions in oci8, they seem a bit kludgy.  Coming from the Perl world, Go/oci8 does not look as easy as Perl/Oracle. Perhaps I have not internalised the "Go way" as yet.


I am sending this hoping for help in oci8 installation.  And for eventual revamp of the package for easier installation.


Sanjay

Jan Mercl

unread,
Nov 18, 2017, 11:57:01 AM11/18/17
to san...@banerji.in, golang-nuts
On Sat, Nov 18, 2017 at 5:09 PM <san...@banerji.in> wrote:

> First, let me thank the person who has written the Oracle (oci8) package for Go (preferred over the other Oracle package).
> However, it seems difficult to install, on Windows at least. Google-ing for help did not give a solution. I am less than 7 hours old in Go, so perhaps after soldering on, I will eventually get to install it.

Please share you experience with the author of the package, he/she may not be aware of the problem because something might be different on your machine, for example. I can't try it as I don't use Windows nor Oracle.

Also, please double check you're installing the package the intended way. Most packages are installed just via go get, but some others have documented alternative methods for various reasons.

> If Go would like to entrench itself even more, perhaps appealing to corporate users would be a good idea. This means that installing linkages to databases used by corporates, such as Oracle, should be a breeze.

The description of the problem doesn't sound like being really connected to Go per se.


> Next, looking at the functions in oci8, they seem a bit kludgy. Coming from the Perl world, Go/oci8 does not look as easy as Perl/Oracle. Perhaps I have not internalised the "Go way" as yet.

Please consult the author(s) of the package, it's unlikely the message gets through using this ML.


> I am sending this hoping for help in oci8 installation. And for eventual revamp of the package for easier installation.

From the post it's not even clear which package is discussed. Is it this one? https://github.com/mattn/go-oci8

--

-j

Tamás Gulácsi

unread,
Nov 18, 2017, 12:35:09 PM11/18/17
to golang-nuts
<shameless_plug>
gopkg.in/goracle.v2 installs with "go get" if a C compiler is ready. Supports calling stored procedures with using database/sql only, too.
</shameless_plug>

Sanjay Banerji

unread,
Nov 20, 2017, 5:35:53 AM11/20/17
to Jan Mercl, golang-nuts

Hello Jan:  Thanks for your prompt reply.  Will try again.  Will contact author after that if unsuccessful.  Yes, it is  https://github.com/mattn/go-oci8  -  My inexpert guess is that there is some problem with how git is installed in my Windows pc.  Sanjay

calum.sh...@gmail.com

unread,
Nov 20, 2017, 8:18:43 PM11/20/17
to golang-nuts
I've managed to get the installation of go-oci8 down to a fairly simple shell script. But it is difficult to get going at first. Here's a few pointers (off the top of my head - I'm not at work and don't have the actual script at hand)

  • Get Msys2 for windows, install it and update it with pacman -Syyu.
  • In a Msys2 shell, install (via pacman) the msys gcc 64bit compiler suite, git (so you can run go get from msys), vim/emacs/[other editor of choice], and importantly for go-oci, pkgconfig
  • Ensure that your GOROOT variable is in the Msys2 path - export PATH=$PATH:$GOROOT/bin - in ~/.bashrc or ~/.bash_profile
  • Download the oracle instant client basic AND sdk, extract the Basic to a folder, and the SDK to the same folder to merge it.
  • You need to set your INCLUDE_PATH and your LIBRARY_PATH to add in the include and lib folders for your instantclient (I think they're in instantclient_12_2/sdk or something like that
  • Then run go get github.com/mattn/go-oci8 and it'll attempt to install and it will fail.
  • copy the oci8.pc file from GOPATH/src/github.com/mattn/go-oci8 to /usr/share/pkgconfig and amend it according to what's in the installation readme
    • Essentially you need to amend the pkgconfig to add in the correct refs to the includes and libs
  • Now re run go get GitHub.com/mattn/go-oci8 and all being good, it should compile.
Note: You will need a number of the instant client dll's alongside your executable, and you may need msvcrt120.dll (I think) or at the very least in the system path when you deploy it.

Once you've got this working, I suggest you also look at rana/ora as well for Oracle.

This should give you a little to be going on with - I can probably update this a bit more formally once I've looked at my auto install script when I'm back in work tomorrow

Hope this helps

Calum
Reply all
Reply to author
Forward
0 new messages