I had a question regarding the use of the Service Link database adapter. We've configured an adapter that will write rows to a certain table in an oracle database. The rows are written into the table correctly. I've also configure the inbound portion of the database adapter to retrieve records but there are 2 problems.
1. When creating the SQL that is used to poll the database table, I'm not able to use the channel id namespace. According to the manuals and training materials that I have reviewed, it looks like you should be able to call #channelid# in your query and the system should automatically translate that. I've tried #channelid#, #channel-id#, and #ChannelID# but if doesn't seem to covert the value to the actual channel ID. Can you use namespaces in the polling query?
2. If I setup the queries without namespaces, I can get into the next step where it excutes the sucessful or failed sql query. I setup a simple transformation that automatically closes the assocaited task when the query is run. I then setup a SQL statement to delete all rows in the table (I only did this because I could not target a row without the channelid namepsace working). The problem is that when I submit a task that uses the agent, the agent polls the database and finds the task. The agent then closes the asscaited task, per my transformation, but when it goes to delete all rows in the table, the rows are not removed. If I execute the same SQL using the same account in a SQLPlus window, the rows are deleted so I think that my SQL is good. I'm not sure why it does not work and the only message in the log is:
2010-07-08 15:52:23,677 DEBUG [com.newscale.is.adapter.db] [ AgentId-5 ] Fetched 1 new records 2010-07-08 15:52:23,804 ERROR [com.newscale.is.adapter.db] Outbound Message Failed to deliever
This is my SQL: delete from rcowner.rcapprovals where STATUS_code='Registered'
The namespace that you can use comes from the SELECT SQL statement. So you need to write out the Channel ID into a field in the db table (you need it around anyway for the transformation). Then the inbound SQL needs to include the channel ID field in the select statement. Then the success/failure SQL statements can reference the channel ID field from the inbound SQL.
Inbound example: SELECT CHANNEL_ID FROM MYTABLE WHERE STATUS = 2 success example: UPDATE MYTABLE SET STATUS=3 WHERE CHANNEL_ID=#channel_id# (Note that it seems to convert field names to all lower case. And the #channel_id# is just referencing the field from the other query -- it isn't a namespace or anything.)
Your delete statement probably isn't working because the db connection is still using the records from the inbound query. Its looping through each record from the inbound query and performing the transformation, then running the success/failrue sql before going onto the next record.