Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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...?

asked 02 Feb '12, 07:20

Yanny's gravatar image

Yanny
1767917
accept rate: 75%

edited 02 Feb '12, 08:18


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.

permanent link

answered 04 Feb '12, 08:25

Yanny's gravatar image

Yanny
1767917
accept rate: 75%

edited 04 Feb '12, 08:26

Glad you got it working:)

(05 Feb '12, 13:22) Volker Barth
1

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

(06 Feb '12, 09:55) RussC_FromSAP

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!

(06 Feb '12, 12:44) Graham Hurst

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.

permanent link

answered 02 Feb '12, 09:32

RussC_FromSAP's gravatar image

RussC_FromSAP
1.3k11030
accept rate: 18%

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.

(02 Feb '12, 09:33) RussC_FromSAP

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');
(02 Feb '12, 10:57) Yanny

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.

(02 Feb '12, 14:08) RussC_FromSAP
Replies hidden

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
(03 Feb '12, 06:20) Yanny

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

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

(03 Feb '12, 07:01) Volker Barth

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

(03 Feb '12, 07:34) Yanny
showing 3 of 6 show all flat view

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
permanent link

answered 03 Feb '12, 09:00

Volker%20Barth's gravatar image

Volker Barth
40.2k361549822
accept rate: 34%

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)...

(03 Feb '12, 13:20) Yanny
Replies hidden

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?

(03 Feb '12, 15:16) Graham Hurst

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...?

(03 Feb '12, 16:03) Yanny

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

(03 Feb '12, 16:27) Volker Barth

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

(03 Feb '12, 16:34) Yanny

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.

(03 Feb '12, 16:50) Graham Hurst

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!

(04 Feb '12, 06:27) Yanny
showing 2 of 7 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×371
×84

question asked: 02 Feb '12, 07:20

question was seen: 3,209 times

last updated: 06 Feb '12, 12:44