Microsoft KB Archive/248668: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "&" to "&")
m (Text replacement - """ to """)
 
Line 12: Line 12:
<div id="TitleRow">
<div id="TitleRow">


= <span id="KB248668"></span>FIX: &quot;Not Enough Storage Is Available to Complete This Operation&quot; with Oracle OLE DB Provider =
= <span id="KB248668"></span>FIX: "Not Enough Storage Is Available to Complete This Operation" with Oracle OLE DB Provider =




Line 87: Line 87:
<pre class="codesample">  CREATE TABLE TABLE1 (FIELD1 NUMERIC (4,0))
<pre class="codesample">  CREATE TABLE TABLE1 (FIELD1 NUMERIC (4,0))
                         </pre></li>
                         </pre></li>
<li><p>Create a Visual Basic application and put the following code in the Form's '''Load''' section (you need to create a DSN named &quot;ORACONN&quot; or modify the code to reflect a DSN you have already created):</p>
<li><p>Create a Visual Basic application and put the following code in the Form's '''Load''' section (you need to create a DSN named "ORACONN" or modify the code to reflect a DSN you have already created):</p>
<pre class="codesample">cnn.Open &quot;dsn=ORACONN;uid=demo;pwd=demo&quot;, , , -1
<pre class="codesample">cnn.Open "dsn=ORACONN;uid=demo;pwd=demo", , , -1
   cmd.ActiveConnection = cnn
   cmd.ActiveConnection = cnn
   
   
   For i = 1 To 7000
   For i = 1 To 7000
     cmd.CommandText = &quot;insert into DEMO.TABLE1 (FIELD1) Values(&quot; & Str(i) & &quot;)&quot;
     cmd.CommandText = "insert into DEMO.TABLE1 (FIELD1) Values(" & Str(i) & ")"
     cmd.Execute
     cmd.Execute
   Next i
   Next i
Line 111: Line 111:
   'Connection string #1 using OLEDB provider for oracle fails when attempting to move to
   'Connection string #1 using OLEDB provider for oracle fails when attempting to move to
   'rows around 5000.
   'rows around 5000.
   strCnn = &quot;Provider=MSDAORA.1;Password=demo;User ID=demo;Data Source=dseoracle8&quot;
   strCnn = "Provider=MSDAORA.1;Password=demo;User ID=demo;Data Source=dseoracle8"
    
    
   'Connection string #2 using MS ODBC for Oracle works fine
   'Connection string #2 using MS ODBC for Oracle works fine
   'strCnn = &quot;DSN=ORACONN;pwd=demo;uid=demo&quot;
   'strCnn = "DSN=ORACONN;pwd=demo;uid=demo"
    
    
   Set rstRecordIDs = New ADODB.Recordset
   Set rstRecordIDs = New ADODB.Recordset
Line 123: Line 123:
   rstRecordIDs.CacheSize = 100
   rstRecordIDs.CacheSize = 100
   Debug.Print cnn.Version
   Debug.Print cnn.Version
   rstRecordIDs.Open &quot;SELECT FIELD1 FROM DEMO.TABLE1 ORDER BY FIELD1&quot;, strCnn, , , adCmdText
   rstRecordIDs.Open "SELECT FIELD1 FROM DEMO.TABLE1 ORDER BY FIELD1", strCnn, , , adCmdText
      
      
     If rstRecordIDs.EOF Then
     If rstRecordIDs.EOF Then
       MsgBox &quot;No records!&quot;
       MsgBox "No records!"
       Exit Sub
       Exit Sub
     End If
     End If
Line 132: Line 132:
   rstRecordIDs.MoveFirst
   rstRecordIDs.MoveFirst
   If rstRecordIDs.EOF Then
   If rstRecordIDs.EOF Then
     MsgBox &quot;No Rows!&quot;
     MsgBox "No Rows!"
     Exit Sub
     Exit Sub
   End If
   End If
    
    
   Do While True
   Do While True
     lstData.AddItem &quot;Record ID: &quot; & rstRecordIDs!FIELD1
     lstData.AddItem "Record ID: " & rstRecordIDs!FIELD1
     rstRecordIDs.MoveNext
     rstRecordIDs.MoveNext
      
      
     If rstRecordIDs.EOF Then
     If rstRecordIDs.EOF Then
       MsgBox &quot;At end of recordset!&quot;
       MsgBox "At end of recordset!"
       Exit Do
       Exit Do
     End If
     End If
Line 149: Line 149:
   Exit Sub
   Exit Sub
Err_cmdDBTest_Click:
Err_cmdDBTest_Click:
     Debug.Print &quot;Error Description : &quot; + Err.Description
     Debug.Print "Error Description : " + Err.Description
End Sub&quot;
End Sub"
                         </pre></li></ol>
                         </pre></li></ol>



Latest revision as of 13:51, 21 July 2020

Knowledge Base


Article ID: 248668

Article Last Modified on 9/30/2003



APPLIES TO

  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0



This article was previously published under Q248668

SYMPTOMS

The following error message may appear when 5000 records or more are retrieved, and when each record contains 4 bytes of data:

8007000e Not enough storage is available to complete this operation.

With a client-side cursor (in other words, when an ActiveX Data Objects (ADO) Recordset's CursorLocation property is set to adUseClient), the following error occurs instead:

80004005 Data provider or other service returned an E_FAIL status

Note that the computer is not really out of memory. Microsoft OLE DB Provider for Oracle and its internal algorithm, which attempts to allocate a buffer to hold the rows, fails if the rowset size is 4 bytes or less.

RESOLUTION

To work around this problem, return recordsets larger than 4 bytes.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in MDAC 2.6.


MORE INFORMATION

Steps to Reproduce the Problem

  1. Create a table in Oracle with the following statement, by using SQL*Plus or some other database utility, and by using the DEMO UserID and DEMO password:

      CREATE TABLE TABLE1 (FIELD1 NUMERIC (4,0))
                            
  2. Create a Visual Basic application and put the following code in the Form's Load section (you need to create a DSN named "ORACONN" or modify the code to reflect a DSN you have already created):

    cnn.Open "dsn=ORACONN;uid=demo;pwd=demo", , , -1
      cmd.ActiveConnection = cnn
     
      For i = 1 To 7000
        cmd.CommandText = "insert into DEMO.TABLE1 (FIELD1) Values(" & Str(i) & ")"
        cmd.Execute
      Next i
                            
  3. Create a Visual Basic form with a list box and a button. In the handler for the button, paste the following code:

    Dim cnn As ADODB.Connection
        Dim cmd As ADODB.Command
        Dim rstRecordIDs As ADODB.Recordset
        Dim strCnn As String
    
        Set cnn = New ADODB.Connection
        Set cmd = New ADODB.Command
       
       On Error GoTo Err_cmdDBTest_Click
       
       'Open recordset from table.
       
       'Connection string #1 using OLEDB provider for oracle fails when attempting to move to
       'rows around 5000.
       strCnn = "Provider=MSDAORA.1;Password=demo;User ID=demo;Data Source=dseoracle8"
       
       'Connection string #2 using MS ODBC for Oracle works fine
       'strCnn = "DSN=ORACONN;pwd=demo;uid=demo"
       
       Set rstRecordIDs = New ADODB.Recordset
       rstRecordIDs.CursorType = adOpenForwardOnly
       rstRecordIDs.LockType = adLockReadOnly
       rstRecordIDs.CursorLocation = adUseServer
       rstRecordIDs.MaxRecords = 100000
       rstRecordIDs.CacheSize = 100
       Debug.Print cnn.Version
       rstRecordIDs.Open "SELECT FIELD1 FROM DEMO.TABLE1 ORDER BY FIELD1", strCnn, , , adCmdText
        
        If rstRecordIDs.EOF Then
          MsgBox "No records!"
          Exit Sub
        End If
       
       rstRecordIDs.MoveFirst
       If rstRecordIDs.EOF Then
         MsgBox "No Rows!"
         Exit Sub
       End If
       
       Do While True
         lstData.AddItem "Record ID: " & rstRecordIDs!FIELD1
         rstRecordIDs.MoveNext
         
         If rstRecordIDs.EOF Then
           MsgBox "At end of recordset!"
           Exit Do
         End If
       Loop
       
       rstRecordIDs.Close
       Exit Sub
    Err_cmdDBTest_Click:
        Debug.Print "Error Description : " + Err.Description
    End Sub"
                            


Keywords: kbbug kbfix kboracle kbprovider kbdatabase kbmdac260fix kbmdacnosweep KB248668