SQLExecDirect crashes (Unhandled exception at 0x1f7b94d2)

171 views
Skip to first unread message

Igor Kuklin

unread,
Feb 12, 2003, 1:29:35 PM2/12/03
to
I am developing an ODBC driver. I am stuck at the call to SQLExecDirect.

Here is the code:

retcode = SQLAllocHandle (SQL_HANDLE_ENV, NULL, &henv);
// Notify ODBC that this is an ODBC 3.0 application.

retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,
(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);

// Allocate an ODBC connection and connect.
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1);

retcode = SQLConnect(hdbc1,
(SQLCHAR*)"servername", SQL_NTS,
(SQLCHAR*)"username", SQL_NTS,
(SQLCHAR*)"pwd", SQL_NTS);

retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc1, &hstmt1);

retcode = SQLExecDirect(hstmt1,
(SQLCHAR*)"SELECT au_lname FROM authors",
SQL_NTS);

All retcode values are 0; however when I execute SQLExecDirect, I get
"Unhandled exception at 0x1f7b94d2 in TestDriver.exe: 0xC0000005: Access
violation reading location 0x00000054."

I checked debug symbols - this happens inside odbc32.dll,
odbc32.dll!_EnterStmtCS@4() + 0x34

I am running XP SP1 / MDAC 2.7 (2.71.9030.4).

I assume something is wrong with my driver, but what? Any ideas?


Igor Kuklin

unread,
Feb 12, 2003, 3:17:23 PM2/12/03
to
Practically I need to know which field is at SQLHSTMT offset 54h. Does
anyone know the internal format of SQLHSTMT? THis is a DWORD according to
debugger.

"Igor Kuklin" <ig...@adessosystems.com> wrote in message
news:eHejlSs0CHA.2232@TK2MSFTNGP09...

Igor Kuklin

unread,
Feb 12, 2003, 7:58:25 PM2/12/03
to
OK, problem solved, thanks. It was related to those implicit descriptors in
SQLAllocHandle.

"Igor Kuklin" <ig...@adessosystems.com> wrote in message

news:OGkG0Ot0CHA.1636@TK2MSFTNGP10...

shanka...@gmail.com

unread,
Apr 9, 2013, 2:13:16 AM4/9/13
to Igor Kuklin
I am also developing an ODBC driver and getting similar error when calling SQLExecDirect. Can you please add more details how the problem was resolved?
Thanks.
Reply all
Reply to author
Forward
0 new messages