Golang DB2 error

D.Tan :

I'm trying to connect to a db2 using golang using https://bitbucket.org/phiggins/db2cli. While trying to follow the instructions, I run into this error

vendor/bitbucket.org/phiggins/db2cli/api/api_unix.go:12:11: fatal 
error: 'sqlcli1.h' file not found
#include <sqlcli1.h>
      ^~~~~~~~~~~
1 error generated.

This is the script I tried to use

#!/bin/bash
DB2HOME=$HOME/sqllib
export CGO_LDFLAGS=-L$DB2HOME/lib
export CGO_CFLAGS=-I$DB2HOME/include

go install .

Could someone point me to what I need to do to use db2cli? I'm running this code on a macbook.

mao :

To build golang with the phiggins db2cli , your workstation or server needs to have a Db2 product (e.g. a suitable client, or a server package) installed locally specifically to deliver the INCLUDE files and the library files for development with Db2.

The Db2-client software comes in different packages for different purposes, and a Db2-client also comes with a Db2-LUW server. For development purposes (i.e. to compile and link executable programs) you need the "IBM Data Server Driver package".

IBM describes the different Db2 client types at this link.

If your remote Db2-server runs on Linux/Unix/Windows, you can also try building golang-db2cli on that hostname and copy the build-targets to your workstation provided the server and workstation run the same distro and bitness and release and that the Db2 version/fixpack is identical to that of the client.

Otherwise you can download and install the relevant package from IBM's Fix Central website (registration required) , or from IBM's Passport Advantage website for registered entitled customers. The Db2-client download links are available currently at this link.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related