Click here to Skip to main content
15,886,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

when I m trying to set Recordset using oracle connection string, I m getting OUt of memory error.

on line "rsLIS.Open sql, gConnLIS, adOpenStatic, adLockReadOnly"


here are the things which I tried :

instead of directly using recordset, I tried to create array (GetRows) method.
Even though recordset count is 26 but UBound of array is showing 1

I have trying changing 3rd argument value from static to forward only in line ""rsLIS.Open sql, gConnLIS, adOpenStatic, adLockReadOnly""
it also didn't work, it was showing recordset.count as 0

Did try after restarting the client system still same
I m getting this error on client side and since at my place I don't have development environment to debug

Error is "OUT OF MEMORY"


VB
<pre>Public Function GetResults_New(MachName As String, patid As String, bCheckDate As Boolean, SendAssay As Boolean) As ADODB.Recordset
On Error GoTo errdesc
Call ShowTempMsg("Line 1")
Dim bXVar As Boolean
Dim i, j As Integer
Dim tmplis, tmporder
Dim tmpresult

bXVar = False

Dim rec_result As New ADODB.Recordset

Dim rsLink As New ADODB.Recordset
Dim rsLIS As New ADODB.Recordset

Dim xSampleIdType As String

gAppPath = AddEditINIfile("VAHSIF.INI", "IF", "sLinkPath", "")
xSampleIdType = AddEditINIfile(gAppPath & "\sLinkConfig.ini", MachName, "SampleIdType", "SampleId1", False)

Call Open_Connection
Call Open_Connection_LIS
rec_result.CursorLocation = adUseClient


If SendAssay = True Then
    rec_result.Fields.Append "machineparamid", adBSTR, 50
    rec_result.Fields.Append "Assayno", adBSTR, 50
    rec_result.Fields.Append "SType", adBSTR, 50
    rec_result.Fields.Append "Dilution", adBSTR, 50
Else
    rec_result.Fields.Append "machineparamid", adBSTR, 50
    rec_result.Fields.Append "SType", adBSTR, 50
    rec_result.Fields.Append "Dilution", adBSTR, 50
End If

rec_result.Open
\
'Link Query For Mapped Params.
sql = "SELECT EquipParamMapping.EquipId, EquipParamMapping.EquipParamCode, EquipParamMapping.LISParamCode, EquipParamMapping.EquipAssayNo from EquipParam, EquipParamMapping where equipParam.equipid = equipparammapping.equipid and equipparam.equipparamcode = equipparammapping.equipparamcode and EquipParam.EquipID = '" & MachName & "' and EquipParam.isProgram = 'Y'"


**rsLink.Open sql, gConn, adOpenStatic, adLockReadOnly**



If enumConnTo = connOracle Then
    sql = "select " & xSampleIdType & " , LIS_Param_Code From SL_21CI_View_sampleid_Orders where " & xSampleIdType & " || SuffixCode = '" & patid & "'  and isApplicable <> 'N'  "
Else
    sql = "select " & xSampleIdType & " , LIS_Param_Code From SL_21CI_View_sampleid_Orders where " & xSampleIdType & " + cast(SuffixCode as varchar(20)) = '" & patid & "'  and isApplicable <> 'N' "
End If

rsLIS.Open sql, gConnLIS, adOpenStatic, adLockReadOnly
 

While Not rsLIS.EOF
    
    If bXVar = True Then
        rsLink.MoveFirst
        bXVar = False
    End If
    While Not rsLink.EOF
    
        bXVar = True

  
        If rsLink.Fields(2).value = rsLIS.Fields(1).value Then
         
            If SendAssay = True Then
               
                rec_result.AddNew
        
                rec_result("machineparamid") = rsLink.Fields("EquipParamCode")
               
                rec_result("Assayno") = rsLink.Fields("EquipAssayNo")
               
                rec_result("SType") = " "
               
                rec_result("Dilution") = "0"
              
                
                rec_result.Update
               
                
                rec_result.MoveFirst
              
                
            Else
            
                rec_result.AddNew
                
                rec_result("machineparamid") = rsLink.Fields("EquipParamCode")
                rec_result("SType") = " "
                rec_result("Dilution") = "0"
                
                rec_result.Update
                
                rec_result.MoveFirst
            End If
            
            GoTo NextParam
        End If
     
        rsLink.MoveNext
    Wend
NextParam:
        rsLIS.MoveNext
Wend
    
Set GetResults_New = rec_result
    
Exit Function
errdesc:
    Call InsertIntoLogWithFileName("Transaction.GetResults_New" & vbNewLine & sql & vbNewLine & err.Description & "ErrLine : " & ErrLine)
End Function


What I have tried:

DBA checked database memory and rest all things its all fine.
Posted
Updated 6-Oct-20 2:03am

1 solution

Quote:
DBA checked database memory and rest all things its all fine.

So it's your code.
"Running out of memory" can mean a lot of things: normally it doesn't mean "actual memory" it means "You have asked for a scarce resource and they are all in use" instead, particularly when it comes to databases.
Since it's not obvious where you close connections and so on, it's probable that you aren't, and using them all up, either in a loop, or via recursion.

So start with the debugger, and see what exactly is happening with yoru code - we can't do that for you as we have no access to the code that calls that method, or the DB itself - and you need them to find out what is happening!
 
Share this answer
 
v2
Comments
Ankit Cheepad 6-Oct-20 9:15am    
Problem is in my system setup is not there like oracle database,.. Is there any other way to find out like adding some logs or anything ?
OriginalGriff 6-Oct-20 9:59am    
You should be testing against a test DB anyway, not the production server. A little slip on your part could damage the "live" database.

So test your software in the debugger!
Ankit Cheepad 6-Oct-20 10:14am    
ok noted with thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900