cancel
Showing results for 
Search instead for 
Did you mean: 

MobiLink .NET API Memory Access exceptions on reader.NextRow()

Former Member
3,022

We are in the process of adding more flexibility to our data partitioning on a working synchronization scheme. Our first step is converting our normal SQL scripts to run under the DirectRow handling for each table and populating the download stream through the .NET API. It all seems to be working fine until we try reading from tables that contain a long varchar or xml type column. For these we have receive either Out of Memory exceptions or Protected Memory Access exceptions.

Versions: SA 12.0.1.3436 (& 3519, latest EBF), .NET 4, Consolidated db running under SA 12.0.1, OS Win 7 x64

SQL is running under the iAnywhere reader, and the exception happens on the first call to NextRow() before we have any chance to access the data in our code. Code snippet with the key elements of the data access is below.

Are there known limitations when dealing with long data types? We have several long binary types in other tables which do download just fine. As long as we skip tables with the long character types everything else succeeds (with a couple workarounds for other small problems).

Thanks

using System.Data;
using iAnywhere.MobiLink.Script;

 ...

// called from handle_download: loop through download tables
// connection is the return from DBConnectionContext.GetConnection()
// downloadCommand is the return from a call to DownloadTableData.GetUpsertCommand()
private void executeDownload(string sqlStatement, DBConnection connection, IDbCommand downloadCommand)
{
    var selectCommand = connection.CreateCommand();
    selectCommand.CommandText = sqlStatement;
    selectCommand.Prepare();

    var tableUpsertParameters = downloadCommand.Parameters;
    var reader = selectCommand.ExecuteReader();

object[] row;
    // memory access exception happens in call to reader.NextRow()
    while ((row = reader.NextRow()) != null)
    {
        //add row to download stream here
    }
    reader.Close();
    selectCommand.Close();
}

Accepted Solutions (1)

Accepted Solutions (1)

I've reproduced the exceptions you reported in the question and have a fix. I'll update this answer tomorrow with a CR# you can use to request an EBF.

0 Kudos

While updating a test for this change, I ran into what I think is your DataReader crash and some other issues. I'll update this post when I've got everything fixed up.

0 Kudos

My fixes are submitted. The CR# is 695370. You'll have to get in touch with support to kick off the EBF process.

Former Member
0 Kudos

Thanks, we'll pick up the EBF & test.

Former Member
0 Kudos

Got an early release and this fixes it.

Answers (0)