Giter VIP home page Giter VIP logo

Comments (35)

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Can you paste the sample program which produced you this error?

Give me some information about the error like:
What were you trying to do?
was the connection successful?

Thanks,
Akhil.

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
Error recurrence step:
1、Download go_ibm_db and configure the environment variable in the home path. Run the demo successfully and go build.I will get binary file.
2、Linux creates Shared folders with Windows
3、Put the binaries in a Shared folder and execute.You will get this error.
Thanks.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @firewaternottogther

Are you executing the binary file in windows?

Thanks,
Akhil

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
No. I execute the binary file at shared folders in linux.
Thanks

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther In step 1, you are configuring the environment variables in the home path. I assume you have updated PATH, INCLUDE, and LD_LIBRARY_PATH env vars. Now, in step 3, you are moving the binary to a different folder. Have you updated the environment variables as per this new folder?

To make it working, please add the .../clidriver/bin:.../clidriver/lib in your PATH and LD_LIBRARY_PATH system environment variable. Then it should work. Thanks.

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
sorry,I disagree.I only change the binary file location, the program reads the location is still the same.Where is the location of the clidriver read in your code and I want to see its logic.
Thanks.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther I have created a shared folder using samba and copied the binary to the shared folder and executed it. It was working fine.

Try to add the clidriver/lib in the $PATH variable and execute the file once again.

Under github.com/ibmdb/go_ibm_db/api folder in each Unix file, we use LDFLAGS linking based on the environment variables. These env vars(CGO_CFLAGS, CGO_LDFLAGS) will have the path to the clidriver.

Thanks,
Akhil

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
I'm so sorry. I tried to add the clidriver/lib in the $PATH variable and execute the file once again.Error is still.
Since this scenario cannot be reproduced, we can change the scenario and put this binary on another host without go environment to run.How do we set the environment variables
Thanks

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther

you can put the binary in any system with same os and architecture ( go lang is platform dependent in case of binaries) but clidriver should be present in that system.
Env's to be set:-
export DB2HOME=/home/uname/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver (PATH TO CLIDRIVER)
export CGO_CFLAGS=-I$DB2HOME/include
export CGO_LDFLAGS=-L$DB2HOME/lib
export LD_LIBRARY_PATH=/home/uname/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver/lib

Thanks,
Akhil.

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
This is the location of the clidrive.
image
Env's to be set:
image
but error are still there.I'm sorry, I really hope you can answer.
image
Thanks.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther

The driver is under root if you don't have the permissions you can't read the data. Try to place the driver in another folder or change the permission by
sudo chmod -R 777 foldername

Thanks,
AKhil

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
After adding permissions, error is still reported.Can we contact each other by email?
image
Thanks

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther
can you collect db2 and cli traces

db2trc on -f trc.dmp
run your application
db2trc off
db2trc flw trc.dmp trc.flw
db2trc fmt trc.dmp trc.fmt
db2trc fmt -c trc.dmp trc.fmtc
db2trc fmt -cli trc.dmp trc.cli
and share the trc.flw, trc.fmt, trc.fmtc and trc.cli files with us to assist you further.

Thanks,
Akhil

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther
Have you collected the traces?

Thanks,
Akhil

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
Sorry for the late reply!
image
Thanks,
Xu

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

@firewaternottogther
share the files, not the Image.
Thanks,
Akhil

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
info.zip
Thanks,
Xu

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @firewaternottogther
There is no data in the file. Can you run the application again when the trace is on and share the files.

Thanks,
Akhil

from go_ibm_db.

firewaternottogther avatar firewaternottogther commented on August 15, 2024

@akhilravuri1
Probably because of my Linux environment.Every time I report this error,even if there is a configuration in the configuration file, I will source /etc/profile and it's ok.I'll look around.
thanks a lot,
xu

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

Hi,
@akhilravuri1
I'm facing the same issue, is this problem resolved ?

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

The problem is because of the user environment issues.

Thanks,
Akhil

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

Thanks for the quick response @akhilravuri1.
Sorry for the late reply.
Here are the environment variables i have set in my LINUX environment.:
export DB2HOME=/home/db2inst2/db2_cli_odbc_driver/odbc_cli/clidriver (PATH TO CLIDRIVER)
export CGO_CFLAGS=-I$DB2HOME/include
export CGO_LDFLAGS=-L$DB2HOME/lib
export LD_LIBRARY_PATH=/home/db2inst2/db2_cli_odbc_driver/odbc_cli/clidriver/lib

but still am facing this error in the GUI of hammerdb
image

What am I doing wrong here? Please guide me, I'm really stuck with this for so long.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @Prathyusha6

Can you please set the env variables to the clidriver downloaded by the go_ibm_db driver?

Just wanted to check later we will replace it with the values you are using.
If you haven't download the clidriver using go_ibm_db please follow the below steps.

go to the installer folder where go_ibm_db is downloaded in your system (Example: /home/uname/go/src/github.com/ibmdb/go_ibm_db/installer) and run setup.go file (go run setup.go)
where uname is the username

The above command will download the clidriver.

Set the below environment variables with the path of the clidriver downloaded

export DB2HOME=/home/uname/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver
export CGO_CFLAGS=-I$DB2HOME/include
export CGO_LDFLAGS=-L$DB2HOME/lib
export LD_LIBRARY_PATH=/home/uname/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver/lib

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

Thanks @akhilravuri1 .
Have downloaded go_ibm_driver and set the environments as:
export DB2HOME=/root/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver
export CGO_CFLAGS=-I$DB2HOME/include
export CGO_LDFLAGS=-L$DB2HOME/lib
export LD_LIBRARY_PATH=/root/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver/lib

but still the error remained same

image

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @Prathyusha6

I see you are working under root..there might be some permission issues.
Please check that.

I will try to reproduce the issue..Please tell us which version of 'go' and 'db2' are you using.
If possible please paste the output of db2level.

Thanks,
Akhil

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

@akhilravuri1
Tried changing the directory to home/user , still getting the same result.

changed env vars to :

export DB2HOME=/home/user/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver
export CGO_CFLAGS=-I$DB2HOME/include
export CGO_LDFLAGS=-L$DB2HOME/lib
export LD_LIBRARY_PATH=/home/user/go/src/github.com/ibmdb/go_ibm_db/installer/clidriver/lib

db2level output

image

should i write or include any configuration files as well ?

i hv added db2cli.ini file with

[tstcli1x]
uid=####
pwd=####
autocommit=0
TableType="'TABLE','VIEW','SYSTEM TABLE'"

[tstcli2x]
; Assuming dbalias2 is a database in DB2 for MVS.
SchemaList="'OWNER1','OWNER2',CURRENT SQLID"

[MyVeryLongDBALIASName]
dbalias=dbalias3
SysSchema=MYSCHEMA

Please help me with this na @akhilravuri1

Thanks,
Prathyusha.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @Prathyusha6

Does your PATH contain multiple dsdriver?

Please paste the output of PATH and LD_LIBRARY_PATH.

Thanks,
Akhil

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

@akhilravuri1
I think no, can you plz guide me where to get it ?
Here are the env vars:

image

Thanks,
Prathyusha

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @Prathyusha6

Are you running go application?

Can you please run this sample go application and paste the output?

package main

import (
    _ "github.com/ibmdb/go_ibm_db"
    "database/sql"
    "fmt"
)

func main(){
    con:="HOSTNAME=host;DATABASE=name;PORT=number;UID=username;PWD=password"
    db, err:=sql.Open("go_ibm_db", con)
    if err != nil{
		fmt.Println(err)
    }
    err = db.Ping()
    if err != nil {
	fmt.Println(err)
    } else {
	 fmt.Println("CONNECTION SUCCESS")
    }
    db.Close()
}

Thanks,
Akhil

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

Hi @akhilravuri1

image

I have set

GOROOT=/usr/local/go/
GOPATH=/home/user/go/src
PATH = $PATH:/usr/local/go/bin

GOROOT and GOPATH are set wrong here ?

Thanks,
Prathyusha

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Go PATH has to home/user/go please remove src.

If you see the image...it checks in /home/user/go/src/src/github.com/ibmdb/go_ibm_db path.

Thanks,
Akhil

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

Oh sry. Thanks @akhilravuri1

Got the success result and tried running hammerdb again but still popping up the same error..
image

from go_ibm_db.

Prathyusha6 avatar Prathyusha6 commented on August 15, 2024

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on August 15, 2024

Hi @Prathyusha6

Sorry for the late reply...I was trying to install HammerDb

yes..we can talk about this in email.

But just for conformation...Does this do anything with go driver?

Because the Go application runs fine in this your previous comment.

Thanks,
Akhil

from go_ibm_db.

DaisyYangl avatar DaisyYangl commented on August 15, 2024

The same issue here, how to solve this please

from go_ibm_db.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.