We reported the following issue on the microsoft.public.sqlserver.odbc
forum:
SELECT
permission to a specific user.SQLPrepare(select * from table)
SQLNumResultCols
. This fails with permission denied.SQLExecute
.
You then get an exception in ODBC Test:
"The instruction at "0x119c8fcc" referenced memory at "0x0170e000". The memory could not be written"
Here's some more detailed output from a different application:
Exception Address: 0X1F9C8F22 Number of Parameters: 2 Exception Record: 0X00000000 Exception Information (RW Flag) : Write Exception Information (Virtual Address) : 0X0162E000 Module: C:\WINNT\System32\SQLSRV32.dll, Section: 01, Offset:00007F22 Call Stack: Address Frame 1F9C8F22 0120F854 SQLNumResultCols+3EB 1F9EF7E4 0120F8B8 BCP_init+5D2 1F9F1737 0120F8CC SQLNativeSqlW+637 1F9F47DA 0120F900 SQLExecute+1E1 1F7CD793 0120F91C SQLExecute+D1 004227CC 0120F988 0001:000217CC C:\WINNT\System32\esoobserver.exe 00419A85 0120FF84 0001:00018A85 C:\WINNT\System32\esoobserver.exe 0042F218 0120FFB8 0001:0002E218 C:\WINNT\System32\esoobserver.exe 77F04EDE 0120FFEC lstrcmpiW+BE No deeper stack frame
Brannon Jones, MDAC Developer said he had reproduced it and submitted a bug report.
We have also reproduced this issue with version 2000.85.1025.00 of the Microsoft SQL Server ODBC driver.
You might be able to identify this problem from the entry the Easysoft ODBC-ODBC Bridge server puts into the application event log or the esoob.exception
file in LogDir
. For example:
Current ODBC-ODBC Bridge Flags: 0X112 OS: Major 5, Minor 0, Build 2195, Service Pack 4 PageSize: 4096, AllocationG: 65536, MinAppA: 00010000, MaxAppA: 7FFEFFFF Active Processor Mask: 1, Number of Processors: 1 Username: XXXXX Computer Name: YYYYY cwd: C:\WINNT\system32 System Dir: C:\WINNT\system32 Windows Dir: C:\WINNT Exception Code: 0XC0000005 (ACCESS_VIOLATION) Exception Flags: 0 Exception Address: 0X0176136B Number of Parameters: 2 Exception Record: 0X00000000 Exception Information (RW Flag) : Write Exception Information (Virtual Address) : 0X01C0D000 exception_filter() at 0041C7B0 RPCAllocHandle() at 0042EE98 Last RPC: Name=sql_execute, Ordinal=91 Current Thread : 2060 Module: C:\WINNT\System32\SQLSRV32.dll, Section: 01, Offset:0000036B Thread List: in_use, threadid, threadh, socket, client_ip, dsn,start_time 0 340 0x00000000 1744 10.10.10.5 - Tue Sep 14 13:25:11 2004
One of our customers came to us with an exception like the one below. After much investigation, it seems that the Microsoft SQL Server ODBC driver was writing off the end of the parameter status array (that is, the buffer set with SQL_ATTR_PARAM_STATUS_PTR
). The circumstances in which this happens are fairly complicated, but can be summarised as:
SQL_ATTR_PARAM_STATUS_PTR
.SQL_ATTR_PARAMSET_SIZE to n (for example, 1000)
.RESET_PARAMS
.SQL_ATTR_PARAMSET_SIZE
to n-m (for example, 800).SQL_ATTR_PARAM_STATUS_PTR
.What seems to be happening is that the driver has missed the reduction in SQL_ATTR_PARAMSET_SIZE
when writing the parameter status array values back.
Easysoft ODBC-ODBC Bridge Version: 02.00.0012 Component: ODBC-ODBC Bridge Server (ODBC thread/process) Build Date: $Built: Jan9 2006 11:30:53 $ Caught Exception on Thu Jan 12 00:36:51 2006 Current ODBC-ODBC Bridge Flags: 0X8112 OS: Major 5, Minor 2, Build 3790, PageSize: 4096, AllocationG: 65536, MinAppA: 00010000, MaxAppA: 7FFEFFFF Active Processor Mask: 3, Number of Processors: 2 Computer Name: XXXXX cwd: C:\WINDOWS\system32 System Dir: C:\WINDOWS\system32 Windows Dir: C:\WINDOWS Exception Code: 0XC0000005 (ACCESS_VIOLATION) Exception Flags: 0 Exception Address: 0X1F9DA74F Number of Parameters: 2 Exception Record: 0X00000000 Exception Information (RW Flag) : Write Exception Information (Virtual Address) : 0X0144910E exception_filter() at 004208C0 RPCAllocHandle() at 00434BFC Last RPC: Name=sql_execute, Ordinal=91 Current Thread : 5884 Module: C:\WINDOWS\system32\SQLSRV32.dll, Section: 01, Offset:0001974F Call Stack: Address Frame 1F9DA74F0184F150SQLDescribeColW+2978 No deeper stack frame Last error from StackWalk = 0 Thread List: in_use, threadid, threadh, socket, client_ip, dsn,start_time 1 760 0x00000118 364 172.20.30.10 vtqrs Thu Jan 12 00:36:16 2006 1 5884 0x0000014C 368 172.20.30.10 vtqrs Thu Jan 12 00:36:16 2006
We reproduced this with Microsoft SQL Server ODBC driver versions 2000.85.1025.00, 2000.86.1830.0, 2000.85.1117.00, and 2000.85.1022.00. It may also happen in other versions.