none
the problem of synchronization of two databases firebird.

    Question

  • I try to synchronize two databases Firebird. Create custom DbSyncProvider. when i try to synchronize SelectScopeInfoCommand an exception is thrown. The code is given below.

    CREATE TABLE SCOPE_INFO1 (

        SCOPE_LOCAL_ID             INTEGER,

        SCOPE_ID                   GUID /* GUID = CHAR(16)  CHARACTER SET OCTETS */,

        SCOPE_NAME                 VARCHAR(100) NOT NULL,

        SCOPE_SYNC_KNOWLEDGE   BLOB SUB_TYPE 0 SEGMENT SIZE 8192,

        SCOPE_FORGOTTEN_KNOWLEDGE  BLOB SUB_TYPE 0 SEGMENT SIZE 8192,

        SCOPE_TIMESTAMP            BIGINT,

        SCOPE_CLEANUP_TIMESTAMP    BIGINT

    );

     

    class TestSyncProvider : Microsoft.Synchronization.Data.DbSyncProvider

        {

            public TestSyncProvider(string scope, string connectionString)

            {

                ScopeName = scope;

     

                Connection = new FbConnection(connectionString);

                Connection.Open();

     

                SelectNewTimestampCommand = Connection.CreateCommand();

                SelectNewTimestampCommand.CommandText = "execute procedure SP_GET_NEXT_DBTS";

                var ts = SelectNewTimestampCommand.CreateParameter();

                ts.Direction = System.Data.ParameterDirection.Output;

                ts.ParameterName = "@sync_new_timestamp";

                SelectNewTimestampCommand.CommandType =  System.Data.CommandType.StoredProcedure;

                SelectNewTimestampCommand.Parameters.Add(ts);

     

                SelectScopeInfoCommand = Connection.CreateCommand();

                ScopeForgottenKnowledgeColName = "SCOPE_TSTONE_CLEANUP_KNOWLEDGE";

                SelectScopeInfoCommand.CommandType =  System.Data.CommandType.Text;

                SelectScopeInfoCommand.CommandText = "select " +

                                               @"SCOPE_LOCAL_ID ,

                                                SCOPE_ID ,

                                                SCOPE_NAME ,

                                                SCOPE_SYNC_KNOWLEDGE ,

                                                SCOPE_TSTONE_CLEANUP_KNOWLEDGE ,

                                                SCOPE_TIMESTAMP,

                                                SCOPE_CLEANUP_TIMESTAMP from SCOPE_INFO1 " +

                                                "where scope_name = @" + DbSyncSession.SyncScopeName;

     

                SelectScopeInfoCommand.Parameters.Clear();

     

                var scopeParameter = SelectScopeInfoCommand.CreateParameter();

                scopeParameter.ParameterName = "@" + DbSyncSession.SyncScopeName;

                SelectScopeInfoCommand.Parameters.Add(scopeParameter);

            }

        }

     

           private void Sync_Click(object sender, EventArgs e)

            {

                try

                {

                   

                    SyncOrchestrator SyncOrchestrator = new SyncOrchestrator();

                    SyncOrchestrator.Direction = SyncDirectionOrder.UploadAndDownload;

     

                    TestSyncProvider sp1 = new TestSyncProvider("sync1", client1.P_ConnectDBString);

                    TestSyncProvider sp2 = new TestSyncProvider("sync1", client2.P_ConnectDBString);

                    SyncOrchestrator.LocalProvider = sp1;

                    SyncOrchestrator.RemoteProvider= sp2;

                    SyncOrchestrator.Synchronize();

                }

                catch

                {

               

                }

     

               

            }

     

     

    System.IndexOutOfRangeException

     Message=Could not find specified column in results.

      Source=FirebirdSql.Data.FirebirdClient

      StackTrace:

           в FirebirdSql.Data.FirebirdClient.FbDataReader.GetColumnIndex(String name) в c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbDataReader.cs:строка 747

           в FirebirdSql.Data.FirebirdClient.FbDataReader.GetOrdinal(String name) в c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbDataReader.cs:строка 377

           в Microsoft.Synchronization.Data.DbSyncScopeHandler.ReadScope(IDbConnection connection, IDbTransaction transaction, ReadKnowledgeType readType, ReadForgottenKnowledgeType readFKtype)

      InnerException:



    • Edited by Andrey1307 Thursday, December 05, 2013 2:19 AM
    Thursday, December 05, 2013 2:13 AM

Answers

  • Сould synchronize table in two embedded firebird DB.

    Project reference: uafile.com/file/34572/SyncTest-work-7z.html

    • Marked as answer by Andrey1307 Monday, January 06, 2014 4:43 PM
    Monday, January 06, 2014 4:43 PM

All replies

  • did you get what column is it complaining about?

    how do you provision your databases?

    Thursday, December 05, 2013 2:57 AM
    Moderator
  • The link for SyncTest downloading. 
    http://uafile.com/file/34487/SyncTest-zip.html

    in the method FBSyncClient::CreateSyncProvider(string ScopeName) should add syncProvider.Connection.Open();

    • Edited by Andrey1307 Thursday, December 05, 2013 4:26 AM
    Thursday, December 05, 2013 4:13 AM
  • in your error above, it's complaining about a column. when you're debugging, what column is it complaining about?
    Thursday, December 05, 2013 4:42 AM
    Moderator
  • There it isn't told, or I don't understand as it to learn. 
    exeption: IndexOutOfRangeExeption. message: Couldn't find specified column in results. That's it. In a clipboard I showed the copy of data of an exception in the first message.I don't know that with it to do.

    Thursday, December 05, 2013 4:54 AM
  • if you put a breakpoint in the debugger on that line where the error occurs, what's the value of 'name' in this line: FirebirdSql.Data.FirebirdClient.FbDataReader.GetColumnIndex(String name) 
    Thursday, December 05, 2013 5:02 AM
    Moderator
  • FirebirdSql.Data.FirebirdClient is the namespace of the dll FIREBIRD ADO NET provider. 
    Thursday, December 05, 2013 5:13 AM
  • am not referring to the assembly. on your error above, you have the exact line where the error is occurring.  

    put a breakpoint here: FirebirdSql.Data.FirebirdClient.FbDataReader.GetColumnIndex(String name) 

    and see what's the value of 'name'.

    Thursday, December 05, 2013 6:18 AM
    Moderator
  • http://uafile.com/file/34494/SyncTest-zip.html

    Has made changes.
    Now, before SyncOrchestrator.Synchronize(); 
    SyncOrchestrator.LocalProvider.Selectscopeinfocommand.commandtext = "select scope_id, scope_local_id, scope_sync_knowledge, scope_forgotten_knowledge, scope_timestamp from scope_info where scope_name column = @sync_scope_name"
    after - exception: The command text for this Command has not been set." and SyncOrchestrator.LocalProvider.Selectscopeinfocommand.commandtext = null;



    • Edited by Andrey1307 Friday, December 06, 2013 1:36 AM
    Thursday, December 05, 2013 9:01 AM
  • Сould synchronize table in two embedded firebird DB.

    Project reference: uafile.com/file/34572/SyncTest-work-7z.html

    • Marked as answer by Andrey1307 Monday, January 06, 2014 4:43 PM
    Monday, January 06, 2014 4:43 PM
  • I too had both of the issues mentioned here, and decided to go back to the Oracle Sample and ported to all Firebird calls.

    I have since published that project to github so that anyone can grab and try it.

    FirebirdSync on Github

    Hopefully this will prevent others from going through the pain I (and others as shown above) have been through.

    Brian Pos

    • Edited by Brian Pos Tuesday, March 11, 2014 5:15 AM calrification
    Tuesday, March 11, 2014 5:15 AM