I have an application that can use DB2 CLI or ODBC connect to DB2, recently I found there is a crash If I connect through ODBC first and then execute a SQL through SQLExecDirect and then disconnect. reconnect database through CLI and then execute the same SQL with SQLExecDirect then I got crash as below
First-chance exception at 0x107af8aa in MyApp.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
0000000006575721 mov r8d,0FFFFFFFDh
0000000006575727 lea rdx,rsp+40h
000000000657572C mov rcx,qword ptr rsp+240h
0000000006575734 call SQLExecDirectW (657A8A4h)
0000000006575739 mov word ptr rsp+248h,ax
The application works fine if I'm not execute the SQL through ODBC first. also worked fine if compile as 32-bit. I'm using DB2V9.7fp3 64-bit client. is there anyone knows what hapend?
This topic has been locked.
1 reply Latest Post - 2012-12-11T08:13:20Z by SystemAdmin
Pinned topic CLI SQLExecutDirect cause crash
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-12-11T08:13:20Z at 2012-12-11T08:13:20Z by SystemAdmin
SystemAdmin 110000D4XK17917 PostsACCEPTED ANSWER
Re: CLI SQLExecutDirect cause crash2012-12-11T08:13:20Z in response to SystemAdminAfter some more debug, I found the db2clio.dll is not unloaded from process when I disconnect from ODBC datasource. And then I connect with CLI and issue SQLExecDirect, the function should call db2cli64.dll!SQLExecDirect, but in debuger db2clio.dll!SqlExecDirect was called! db2clio.dll and db2cli64.dll are both loaded into my process. So looks like CLI called an incorrect function, is this a CLI's bug?