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 am developing an application to perform data replication between one database and another, replication will be done through Trigger. I need to identify which application is performing a certain operation, and through this feature I mean to trigger that if the responsible By changing the application X it will not do anything. Objective: Avoid the infinite loop.

How do I send the name to the connection, would like to pass the name of the executable, to be identified in the process. If it is not possible how do I get the name of this connection when connecting.

See Image

asked 23 Jun '17, 15:40

Walmir%20Taques's gravatar image

Walmir Taques
accept rate: 12%

edited 23 Jun '17, 17:29


replication will be done through Trigger.

Wow, SQL Anywhere used with a homegrown replication method - wouldn't the builtin tools SQL Remote or MobiLink do that for you?

FWIW, you can name a connection by using the CON connection parameter, and you can identify an application based on the AppInfo connection parameter. However, it might be more robust to use a different user for that purpose. Note, SQL Remote does use the particular CURRENT REMOTE USER to identify operations applied by the Message Agent (i.e. done through replication) to distinguish those from "normal" activities.

(24 Jun '17, 06:11) Volker Barth
Replies hidden
Comment Text Removed

Mobililink is very likely to work, but ... the manager wants the "our own replicator" to be made (the words he used).

And now I'm trying to develop the wheel again, anyway ..

By the way, creating a remote user answered my question. Thank you!

(27 Jun '17, 09:04) Walmir Taques

The connection can be given a name with the ConnectionName (CON) connection parameter; for example:

  -c "ENG=ddd16;DBN=ddd16;UID=dba;PWD=sql;CON=ddd16-2"

The connection name can be retrieved inside a trigger using the CONNECTION_PROPERTY ( 'Name' ) function call; for example:

SET @connection_name = CONNECTION_PROPERTY ( 'Name' );

See List of connection properties.

The CREATE VARIABLE statement can be used to create connection-level user variables that pass data down to triggers. These are very useful since triggers don't have arguments and parameters. They are sometimes called "global variables" because the values are available to all SQL code running on the one connection.

Question: Why are you building your own replication? I understand that SQL Remote and MobiLink have their limitations, but it is strongly suggested you use them as a transport mechanism... they solve many many many many many problems you will run into. For example, I recently used triggers on ASE and ASA to port a large Replication Server application over to MobiLink without losing the "operation-level" nature of the synchronization (MobiLink does row-level, SQL Remote does transaction-level, neither works exactly like Rep Server, and this App From Hell had its own ASE and ASA triggers that wanted to see every single replicated insert, update and delete).

permanent link

answered 24 Jun '17, 17:47

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

Answering your question: Mobililink works, I was directed to develop "our own replicator". Thank you!

(27 Jun '17, 09:29) Walmir Taques
Replies hidden

I was directed to develop "our own replicator".

Our thoughts are with you.

(27 Jun '17, 09:40) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 23 Jun '17, 15:40

question was seen: 1,452 times

last updated: 27 Jun '17, 09:40