cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax error Mobilink "begin_upload" script

Former Member
3,504

I get the following error:

I. 2012-02-02 12:51:32. <5> Synchronization connection connected
I. 2012-02-02 12:51:32. <5> ODBC isolation set to: Read Committed
I. 2012-02-02 12:51:32. <5> COMMIT Transaction: begin_connection
I. 2012-02-02 12:51:32. <5> The current synchronization is using a connection with SPID '22'
I. 2012-02-02 12:51:32. <5> COMMIT Transaction: begin_synchronization
E. 2012-02-02 12:51:32. <5> [-10002] Consolidated database server or ODBC error:  ODBC: [Sybase][ODBC Driver]    [SQL Anywhere]Syntax error near '(end of line)' on line 1 (ODBC State = 42000, Native error code = -131)
I. 2012-02-02 12:51:32. <5> The begin_upload script caused an error when invoked
I. 2012-02-02 12:51:32. <5> Error Context:
I. 2012-02-02 12:51:32. <5> Remote ID: 0487e3c0-4d81-11e1-8000-e85e01eb06b3
I. 2012-02-02 12:51:32. <5> User Name: mobielcmp
I. 2012-02-02 12:51:32. <5> Modified User Name: mobielcmp
I. 2012-02-02 12:51:32. <5> Transaction: upload
I. 2012-02-02 12:51:32. <5> Table Name: action
I. 2012-02-02 12:51:32. <5> Script Version: Mobiel-CMP-Synchronization
I. 2012-02-02 12:51:32. <5> Script: 
I. 2012-02-02 12:51:32. <5> End of Error Context
I. 2012-02-02 12:51:32. <5> ROLLBACK Transaction: end_upload
I. 2012-02-02 12:51:32. <5> ROLLBACK Transaction: end_synchronization
I. 2012-02-02 12:51:32. <5> COMMIT Transaction: end_connection
I. 2012-02-02 12:51:32. <5> A synchronization connection with SPID '22' has been disconnected
I. 2012-02-02 12:51:32. <5> Synchronization failed

This is the code for the handle_uploadData event:

public void processActionParameter( UploadData ut ) throws SQLException {
    UploadedTableData tabelActionParameter = ut.getUploadedTableByName("actionParameter");
    UploadedTableData tabelAction = ut.getUploadedTableByName("action");
    // Get inserts, updates uploaded by the MobiLink client
    ResultSet actionParameterResultSet = tabelActionParameter.getInserts();
    UpdateResultSet actionParameterUpdateResultSet = tabelActionParameter.getUpdates();
   // int success = 0;
    try {
        //pass to this method to insert into the consolidated table
        insertActionIntoConsolidatedTable(actionParameterResultSet, tabelAction);
        updateActionConsolidatedTable(actionParameterUpdateResultSet);
        //success = 1;
    } catch (SQLException exception) {
        System.out.println(exception.getMessage());
        //success = 0;
    }
    //close result set
    actionParameterResultSet.close();
}

It seems there is a syntax error in the synchronization script I have written. But the problem is, I don't know which line is causing this error in my Java code...?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

alt text

The solution to this error is to remove the "action (mobielcmp): begin_upload" line. To remove it right click on that line and choose to delete it.

VolkerBarth
Contributor
0 Kudos

Glad you got it working:)

Former Member

Hmmm. I thought we ignored scripts that were all whitespace. I'll check into that.

Former Member
0 Kudos

So you must have been redeploying the sync model after you ran ml_add_connection_script with null for the script body. Thanks for adding that missing information and the solution!

Answers (2)

Answers (2)

VolkerBarth
Contributor
0 Kudos

Could you check if there are more events defined than desired? - AFAIK, you can query the tables ml_script, ml_connection_script and ml_table_script to list all defined scripts.

Or use the following handy views:

select * from ml_connection_scripts
where version = 'Mobiel-CMP-Synchronization'
order by 2

select * from ml_table_scripts
where version = 'Mobiel-CMP-Synchronization'
order by 2, 3
Former Member
0 Kudos

Ok when I run the first query I get the following result: http://s14.postimage.org/8bkejr7ld/Screen_shot_2012_02_03_at_19_07_20.png

When I run the second query I get the following result: http://s16.postimage.org/a6hgpyjwl/Screen_shot_2012_02_03_at_19_19_23.png

I see the begin_upload event the script column empty is (on the right)...

Former Member
0 Kudos

That row should have been removed when you ran ml_add_connection_script with null for the script body, as Volker suggested. Perhaps the change wasn't committed?

Former Member
0 Kudos

Well I run that command in the Interactive SQL and it says: Execution time: 0.004 seconds Procedure completed

I suppose this mean it was successfully removed? Or should it say X rows affected...?

VolkerBarth
Contributor
0 Kudos

Well, just repeat the queries above and check the results. The according row should have been removed now...

Former Member
0 Kudos

Everything is the same. I mean the sql queries results are the same just like before..

Former Member
0 Kudos

Then try running it again and then run COMMIT. It may be that Interactive SQL is not set to autocommit, or only commits when you close the connection.

You'll also need to restart the MobiLink server, unless you started it with -zf.

Former Member
0 Kudos

Found out that I earlier accidentally selected the "begin_upload" event in the events dropdownmenu in Sybase Central > Synchronization Model.

Here is a screenshot for more clarification:

http://s14.postimage.org/xt2psa81t/Screen_shot_2012_02_04_at_12_25_01.png

As you can see, it is marked as blue which means user-defined. How can I possibly delete this begin_upload event, as I don't need this one and I think it is the cause of the begin_upload error!

Former Member
0 Kudos

The "syntax error near end of line" error is usually due to a trailing semi-colon (;) character. If you have a trailing semi-colon in your begin_upload script, try removing it.

Former Member
0 Kudos

If that doesn't work, please post a -v+ log. That way we'll be able to see the script and you/we should be able to see what's going on.

Former Member
0 Kudos

I don't have defined a begin_upload script. They only scripts I defined are displayed below:

call ml_add_connection_script('Mobiel-CMP-Synchronization','handle_UploadData','MobielCMPSynchronization.processActionParameter');
call ml_add_java_connection_script('Mobiel-CMP-Synchronization', 'handle_DownloadData', 'MobielCMPSynchronization.processActionResult');
call ml_add_java_connection_script('Mobiel-CMP-Synchronization', 'begin_download', 'MobielCMPSynchronization.beginDownload');
call ml_add_java_connection_script('Mobiel-CMP-Synchronization', 'end_connection', 'MobielCMPSynchronization.endConnection');
Former Member
0 Kudos

One change you need to make is to call ml_add_java_connection_script for handle_UploadData, not ml_add_connection_script. This script is currently being defined as 'sql' instead of 'java'. It could be that the handle_UploadData being defined as SQL causes ML server to issue the begin_upload error, somehow. I doubt we test this case of bad input.

Former Member
0 Kudos

I changed to ml_add_java_connection_script for the handle_UploadData. I still get the error, so I started the Mobilink server with the option -v+ and here is the log:

E. 2012-02-03 12:07:19. <4> [-10002] Consolidated database server or ODBC error:  ODBC: [Sybase][ODBC Driver][SQL Anywhere]Syntax error near '(end of line)' on line 1 (ODBC State = 42000, Native error code = -131)
I. 2012-02-03 12:07:19. <4> The begin_upload script caused an error when invoked
I. 2012-02-03 12:07:19. <4> Error Context:
I. 2012-02-03 12:07:19. <4> Remote ID: d5b17150-2c2a-11e1-8000-afbeb0a6b374
I. 2012-02-03 12:07:19. <4> User Name: mobielcmp
I. 2012-02-03 12:07:19. <4> Modified User Name: mobielcmp
I. 2012-02-03 12:07:19. <4> Transaction: upload
I. 2012-02-03 12:07:19. <4> Table Name: action
I. 2012-02-03 12:07:19. <4> Script Version: Mobiel-CMP-Synchronization
I. 2012-02-03 12:07:19. <4> Script:
I. 2012-02-03 12:07:19. <4> End of Error Context
I. 2012-02-03 12:07:19. <4> report_error <connection> (no script)
I. 2012-02-03 12:07:19. <4> report_odbc_error <connection> (no script)
I. 2012-02-03 12:07:19. <4> end_upload action (no script)
I. 2012-02-03 12:07:19. <4> end_upload <connection> (no script)
I. 2012-02-03 12:07:19. <4> ROLLBACK Transaction: end_upload
I. 2012-02-03 12:07:19. <4> end_publication <connection> (no script)
I. 2012-02-03 12:07:19. <4> end_synchronization action (no script)
I. 2012-02-03 12:07:19. <4> end_synchronization actionParameter (no script)
I. 2012-02-03 12:07:19. <4> end_synchronization <connection> (no script)
I. 2012-02-03 12:07:20. <4> synchronization_statistics action (no script)
I. 2012-02-03 12:07:20. <4> synchronization_statistics actionParameter (no script)
I. 2012-02-03 12:07:20. <4> synchronization_statistics <connection> (no script)
I. 2012-02-03 12:07:20. <4> time_statistics action (no script)
I. 2012-02-03 12:07:20. <4> time_statistics actionParameter (no script)
I. 2012-02-03 12:07:20. <4> time_statistics <connection> (no script)
I. 2012-02-03 12:07:20. <4> ROLLBACK Transaction: end_synchronization
I. 2012-02-03 12:07:20. <4> System event on synchronization connection:
                    { CALL ml_lock_rid( ?, ?, ? ) }
I. 2012-02-03 12:07:20. <4> Translated SQL:
                    CALL ml_lock_rid( ?, ?, ? )
I. 2012-02-03 12:07:20. <4> System event on synchronization connection:
                    UPDATE ml_database SET sync_key = ? WHERE rid = ?
I. 2012-02-03 12:07:20. <4> Translated SQL:
                    UPDATE ml_database SET sync_key = ? WHERE rid = ?
I. 2012-02-03 12:07:20. <4> end_connection <connection>
                    MobielCMPSynchronization.endConnection
I. 2012-02-03 12:07:20. <4> COMMIT Transaction: end_connection
I. 2012-02-03 12:07:20. <4> A synchronization connection with SPID '58' has been disconnected
I. 2012-02-03 12:07:20. <4> Synchronization failed
I. 2012-02-03 12:07:20. <4> PHASE: start_time: 2012-02-03 12:07:19.248
I. 2012-02-03 12:07:20. <4> PHASE: duration: 1012
I. 2012-02-03 12:07:20. <4> PHASE: sync_request: 0
I. 2012-02-03 12:07:20. <4> PHASE: receive_upload: 182
I. 2012-02-03 12:07:20. <4> PHASE: get_db_worker: 100
I. 2012-02-03 12:07:20. <4> PHASE: connect: 70
I. 2012-02-03 12:07:20. <4> PHASE: authenticate_user: 187
I. 2012-02-03 12:07:20. <4> PHASE: begin_sync: 53
I. 2012-02-03 12:07:20. <4> PHASE: apply_upload: 420
I. 2012-02-03 12:07:20. <4> PHASE: prepare_for_download: 0
I. 2012-02-03 12:07:20. <4> PHASE: fetch_download: -2109096802
I. 2012-02-03 12:07:20. <4> PHASE: end_sync: 0
I. 2012-02-03 12:07:20. <4> PHASE: send_download: -2109096508
I. 2012-02-03 12:07:20. <4> PHASE: wait_for_download_ack: 0
I. 2012-02-03 12:07:20. <4> PHASE: get_db_worker_for_download_ack: 0
I. 2012-02-03 12:07:20. <4> PHASE: connect_for_download_ack: 0
I. 2012-02-03 12:07:20. <4> PHASE: nonblocking_download_ack: 0
VolkerBarth
Contributor
0 Kudos

...and you will also have to remove the undesired SQL script by calling

call ml_add_connection_script('Mobiel-CMP-Synchronization','handle_UploadData', NULL);

Former Member
0 Kudos

I have removed it. No still doesn't work, still getting that error.