FSQL OPC to DB Group writes back to OPC


I have setup 2 FSQL groups. One in either direction, DB to OPC, and OPC to DB.
DB to OPC works as intended.
But OPC to DB seems to fetch data from the database and write it back to OPC.
There are no error messages.
The database is Oracle.
I write to the first record in the table. It is set to Update/Select first record.

Any ideas ?

That’s strange.

  1. I suspect that the problem is that the correct row is not being used. You indicated elsewhere that the table already existed. Normally, FactorySQL creates the table and uses the lowest value of the table’s primary key to pick the “first” record. Oracle is a bit different than the other RDBMS systems in how you create a sequence then a trigger.

The solution: Choose “update/select->custom”. You will create a WHERE clause by choosing an identifying column and it’s associated value. For example, if you have a column called rownum whose current value is 1, type “rownum=1”, without the quotes. Use any column whose value isn’t changing for testing. For best practice, the real column should be unused (metadata) and indexed.

  1. Are you sure that your account has write permissions to that table? Try manually running an UPDATE query with that user. Use Tools->Database query browser if you don’t have access to a frontend.

Hi Nathan.

I sorted this problem only to get a new one.

It was my inexperience with FSQL. I thought that setting the mode for the entire group would set all the tags. However, there is also a setting for each tag. And this was set to “DB to OPC”.

I have a new problem though.
Writes to DB fails with this error code:
“Error executing update query: ERROR (NA000) (Microsoft)(ODBC driver for Oracle)(Oracle)ORA-01031: Insufficient privileges …”

What is strange is that my VBS code could write to the table. The connection is also OK I know, because I could read from the table.

Sorted :slight_smile:

I had misunderstood that writes had to be inserted into the table.
The customer had made constraints that one record could not be written to twice.
So I changed it from write to 1st record to Insert new record.

Now we have to make a warm test. Hope it goes well now.