locked
Having problem with selectNewAnchorCommand for an odbc(MySql) client RRS feed

  • Question

  • Hi,

    I'm trying to synchronize between a Microsoft SQL Server 2008  and a MySQL Client.

    My anchor type is of SqlServer datetime and in the mysql its type iאs timestamp.

    I tried to create a custom ClientSyncProvider similar to SqlExpressClient Sample, meaning a class derived from a ClientSyncProvider and warping a DbServerSyncProvider class, my client databse is of MySQL type and I'm using ODBC to interact with it.

    I'm getting "Size property has an invalid size of 0" when my selectNewAnchorCommand is called.

    I tried using both "set @sync_new_received_anchor = CURRENT_TIMESTAMP()" and "select @sync_new_received_anchor = CURRENT_TIMESTAMP()" and they both provide the same exception.

    I copy-paste the full details of the exception down below.

    Any help would be appreciated thanks in advance,

    Zur

     

     

    Anchor command

    OdbcCommand selectNewAnchorCommand = new OdbcCommand("set @sync_new_received_anchor = CURRENT_TIMESTAMP()");

    selectNewAnchorCommand.Parameters.Add("@sync_new_received_anchor", OdbcType.Timestamp);

    selectNewAnchorCommand.Parameters["@sync_new_received_anchor"].Direction = ParameterDirection.Output;

    clientSyncProvider.SelectNewAnchorCommand = selectNewAnchorCommand;

     

    Exception Message:

    Byte[][1]: the Size property has an invalid size of 0.

     

    Exception Stack trace:

       at System.Data.Odbc.OdbcParameter.GetParameterSize(Object value, Int32 offset, Int32 ordinal)

       at System.Data.Odbc.OdbcParameter.PrepareForBind(OdbcCommand command, Int16 ordinal, Int32& parameterBufferSize)

       at System.Data.Odbc.OdbcParameterCollection.CalcParameterBufferSize(OdbcCommand command)

       at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)

       at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)

       at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()

       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetNewServerAnchor(SyncGroupMetadata groupMetadata, SyncSession session)

       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)

       at newSynchronizer.OdbcClientSyncProvider.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession) in C:\Documents and Settings\zur\My Documents\Visual Studio 2005\Projects\newSynchronizer\newSynchronizer\OdbcClientSyncProvider.cs:line 320

       at Microsoft.Synchronization.SyncAgent.UploadChanges(SyncGroupMetadata groupMetadata)

       at Microsoft.Synchronization.SyncAgent.DataSynchronize()

       at Microsoft.Synchronization.SyncAgent.Synchronize()

       at newSynchronizer.SyncForm.m_BtnSync_Click(Object sender, EventArgs e) in C:\Documents and Settings\zur\My Documents\Visual Studio 2005\Projects\newSynchronizer\newSynchronizer\SyncForm.cs:line 212

     

    Sync Fx tracing

    VERBOSE, newSynchronizer.vshost, 11, 10/19/2010 09:30:55:296, enrolllog: Read SentAnchor value: 18446742974197924096

    VERBOSE, newSynchronizer.vshost, 11, 10/19/2010 09:30:55:296, enrolllog: Read ReceivedAnchor value: 1/1/2000 12:00:00 AM

    VERBOSE, newSynchronizer.vshost, 11, 10/19/2010 09:30:55:312, Connecting to database: 

    INFO   , newSynchronizer.vshost, 11, 10/19/2010 09:30:55:328, ----- Server Enumerating Changes to Client for Group "enrolllog" -----

    INFO   , newSynchronizer.vshost, 11, 10/19/2010 09:30:55:343,               Client Id: 7209c5bf-bb14-4ce1-a581-ccf0c2d1d69d

    INFO   , newSynchronizer.vshost, 11, 10/19/2010 09:30:55:343,    Mapped Originator Id: 0

    VERBOSE, newSynchronizer.vshost, 11, 10/19/2010 09:30:55:359, Using Command: set @sync_new_received_anchor = CURRENT_TIMESTAMP()

    VERBOSE, newSynchronizer.vshost, 11, 10/19/2010 09:30:55:359,    Parameter: @sync_new_received_anchor Value: Skipped since Not Input/InputOutput

    VERBOSE, newSynchronizer.vshost, 11, 10/19/2010 09:30:55:359, 

    INFO   , newSynchronizer.vshost, 11, 10/19/2010 09:30:55:375, --- End Server Enumerating Changes from Client for Group "enrolllog" ---

    INFO   , newSynchronizer.vshost, 11, 10/19/2010 09:30:55:375, Closing connection to server


    Tuesday, October 19, 2010 9:38 AM

Answers