Microsoft KB Archive/186378

= FIX: Keywords in WHERE Clause Cause Oracle ODBC Driver Errors =

Article ID: 186378

Article Last Modified on 3/2/2005

-

APPLIES TO


 * Microsoft Open Database Connectivity 2.0
 * Microsoft Open Database Connectivity 2.0
 * Microsoft Open Database Connectivity 2.0

-



This article was previously published under Q186378



SYMPTOMS
The Microsoft Oracle Driver parses the string contents of the WHERE clause for SQL keywords. For example:   SELECT * FROM PRBSPACE WHERE C1 = 'For Your Eyes Only' Some SQL keywords generate different errors. The SQL keywords must be followed by a space to cause the problem. The sample provided later shows the problem with the FOR and SELECT keywords. The problem is case insensitive and the ORDER and GROUP keywords also cause the same problem.



STATUS
This has been fixed in the 2.573.2927 version or later of the Microsoft Oracle ODBC driver. The 2.573.2927 driver is available in Visual Studio 6.0 and Microsoft Data Access Components version 2.0.

This also has been fixed in 2.573.4403.00 version of the Microsoft Oracle ODBC driver and is available in Microsoft Data Access Component (MDAC) version 2.5.

The current MDAC components can be downloaded at from the following Web address:

http://msdn.microsoft.com/dataaccess



Steps to Reproduce Behavior in ODBCTest
First, create the table:   CREATE TABLE PRBSPACE (C1 VARCHAR(20))

INSERT INTO PRBSPACE VALUES ('For Your Eyes Only') INSERT INTO PRBSPACE VALUES ('Select a Word') INSERT INTO PRBSPACE VALUES ('This is a test')  FULL CONNECT(Use Driver).  SET CURSOR ATTRIBUTES  SQL_CURSOR_KEYSET_DRIVEN=1 SQL_CONCUR_VALUES=4 Click OK.  Type the following SQL in the Execute window:

SELECT * FROM PRBSPACE WHERE C1 = 'For Your Eyes Only'  SQLPrepare. SQLExecute.</li> SQLBindCol.</li> SQLExtendedFetch.</li></ol>

RESULTS:

Return: SQL_NO_DATA_FOUND=100

To show that the steps above work, use the following SQL Statement: <pre class="fixed_text">  SQLCancel

Change the WHERE clause string to (this works): <pre class="fixed_text">  SELECT * FROM PRBSPACE WHERE C1 = 'This is a test' Follow steps 4 through 7. No Error, and data is returned.

To show that different KEYWORDS are effecting the query try the following: <pre class="fixed_text">  SQLCancel Change the WHERE clause to: <pre class="fixed_text">  SELECT * FROM PRBSPACE WHERE C1 = 'Select a Word' Follow steps 4 through 7. Now the error occurs on the SQLPrepare:

[Microsoft][ODBC driver for Oracle]Cannot use Keyset-driven cursor on join, with distinct clause, union, intersect or minus or on read only result set.

Keywords: kbbug kbfix kboracle kbdatabase kbvbp600fix kbdriver kbmdacnosweep KB186378

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.