Microsoft Knowledge Base Email Alertz

(238296) - When passing a parameter in a SQL statement in an Oracle NT database using Oracle's ODBC driver version 8.00.50 and the Microsoft OLE DB Provider for ODBC, an access violation occurs in SQORA32.dll. Here is an example of the SQL String that might...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 238296 - Last Review: December 5, 2003 - Revision: 3.1

PRB: Access Violation in SQORA32.dll when Using ODBC OLE DB Provider

This article was previously published under Q238296

SYMPTOMS

When passing a parameter in a SQL statement in an Oracle NT database using Oracle's ODBC driver version 8.00.50 and the Microsoft OLE DB Provider for ODBC, an access violation occurs in SQORA32.dll.

Here is an example of the SQL String that might cause a problem:
Insert into table1 values(?)
				
The problem only occurs when specifying a length part (DBPART_LENGTH) for the accessor.

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

CAUSE

The OLE DB Provider for ODBC performs the following sequence of ODBC calls:
  • SQLSetStmtAttr with SQL_ATTR_PARAM_BIND_OFFSET.
  • SQLBindParameter passing null for the octet length.
  • SQLDescField with SQL_DESC_OCTECT_LENGTH_PTR.
Oracle's ODBC driver should be adding the values specified by the SQL_ATTR_PARAM_BIND_OFFSET and SQL_DESC_OCTECT_LENGTH_PTR. Instead, Oracle ignores the value in SQL_ATTR_PARAM_BIND_OFFSET. This causes an invalid address to be calculated.

RESOLUTION

Please contact Oracle Corporation for more information on obtaining a fixed version of Oracle's ODBC driver.
For information about how to contact Oracle Corporation, click the appropriate article number in the following list to view the article in the Microsoft Knowledge Base:
65416  (http://kbalertz.com/Feedback.aspx?kbNumber=65416/EN-US/ ) Hardware and Software Third-Party Vendor Contact List, A-K

60781  (http://kbalertz.com/Feedback.aspx?kbNumber=60781/EN-US/ ) Hardware and Software Third-Party Vendor Contact List, L-P

60782  (http://kbalertz.com/Feedback.aspx?kbNumber=60782/EN-US/ ) Hardware and Software Third-Party Vendor Contact List, Q-Z

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Problem

  1. Create a table with a char(50) field.
  2. Run the ATL OLE DB Consumer Wizard in Visual C++ to create an accessor class for the table.
  3. Modify the class so that it uses a parameter map rather than a column map such as:
    class CInsertTestAccessor
    {
    	public:
    		TCHAR m_szField1[51];
    		ULONG m_lLength;
    
    		BEGIN_PARAM_MAP(CInsertTestAccessor)
    			SET_PARAM_TYPE(DBPARAMIO_INPUT)
                            COLUMN_ENTRY_LENGTH(1, m_szField1, m_lLength)
    		END_PARAM_MAP()
    };
    						
  4. Add the following code to insert a value into the table using an INSERT INTO command with a parameter:
    	// open a connection using the connection string
    	CDataSource ds;
    	hr = ds.OpenFromInitializationString(T2W(m_strConnection));
    	
    	CSession sn;
    	sn.Open(ds);
    
    	CCommand<CAccessor<CInsertTestAccessor> > cmd;
    
    	TCHAR szSQLInsert[200];
    	szSQLInsert[0]='\0';
    	_tcscat(szSQLInsert, _T("Insert into "));
    	_tcscat(szSQLInsert, _T(m_strTableName));
    	_tcscat(szSQLInsert, _T(" VALUES (?)"));
    
    	//insert the record
    	_tcscpy(cmd.m_szField1, _T("string"));
    	cmd.m_lLength = strlen(cmd.m_szField1);
    
    
    	// Set properties for open
    	LPCTSTR szCommand = NULL;
    	hr = cmd.CreateCommand(sn);
    	CComPtr<ICommandText> spCommandText;
    	hr = cmd.m_spCommand->QueryInterface(&spCommandText);
    	if (SUCCEEDED(hr))
    	hr = spCommandText->SetCommandText(DBGUID_SQL, T2COLE(szSQLInsert));
    
    	cmd.Open(sn, szSQLInsert);
    	cmd.Close();
    
    						
The variables m_strConnection and m_strTableName in the code earlier are CStrings. You can replace these with your own strings that represent the connection string and table name respectively.

APPLIES TO
  • Microsoft OLE DB Provider for ODBC 1.0
  • Microsoft OLE DB Provider for ODBC 2.0
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbdatabase kbdtl kbmdacnosweep kboracle kbprb kbprovider kbtemplate KB238296
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate