Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLGetDiagRec failed : ret = -2 when import odbc and go_ibm_db at the same time #260

Open
NingQue0920 opened this issue Jan 21, 2025 · 3 comments

Comments

@NingQue0920
Copy link

  • os Version: Centos7 linux amd64
  • cli-driver Version:
  • Db2 Server Version: 9.7.6
  • go Version: 1.22
go env Output:
$ go env

Image

Steps to Reproduce:

  1. When depend on both the "github.com/alexbrainman/odbc" and "github.com/ibmdb/go_ibm_db" packages simultaneously, there is a probability of encountering an error when connecting to a DB2 database: panic: SQLGetDiagRec failed: ret = -2.
  2. After I removed the dependency on "github.com/alexbrainman/odbc", every execution could perform queries correctly.

Image

Image

@NingQue0920
Copy link
Author

What puzzles me is that this error doesn't occur every time; instead, it happens sporadically.

@NingQue0920 NingQue0920 changed the title SQLGetDiagRec failed : ret = -2 SQLGetDiagRec failed : ret = -2 when import odbc and go_ibm_db at the same time Jan 21, 2025
@vmathur12
Copy link
Collaborator

@NingQue0920 ,
The issue not reproduceable in my environment. But I am getting different errors related /alexbrainman/[email protected] package.
The issue could be because of github.com/alexbrainman/odbc and github.com/ibmdb/go_ibm_db packages has same api's names.
Import either alexbrainman/odbc or ibmdb/go_ibm_db package.
Thanks.

@NingQue0920
Copy link
Author

@NingQue0920 , The issue not reproduceable in my environment. But I am getting different errors related /alexbrainman/[email protected] package.这个问题在我的环境中无法再现。但是我遇到了不同的错误 / Alexbrainman / [email protected]包装。 The issue could be because of github.com/alexbrainman/odbc and github.com/ibmdb/go_ibm_db packages has same api's names.问题可能是因为github.com/alexbrainman/odbc和github.com/ibmdb/go_ibm_db软件包具有相同的API名称。 Import either alexbrainman/odbc or ibmdb/go_ibm_db package.导入Alexbrainman/ODBC或IBMDB/GO_IBM_DB软件包。 Thanks.  谢谢。

Yes, go_ibm_db and odbc has some same api's name , so I have to change one of them. You can change it and retry

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants