Cannot use the Encrypted SQLite on node serverside

Cannot use the Encrypted SQLite on node server-side.


Hello, 
We are trying to build an application which uses an SQLite on Windows.

For the encryption, we use the TFDConnection with FDManager. And the connection params has the Pooled set true.

In a node server-side during doing the "Route" and "BatchLoad", it occurred foreign key error. 
But uses the TSQLiteNativeConnectionAdapter, it's ok.

Is there something that I need to do please? 



The error occurred after many records inserted.

Hello,

I don't know what is the meaning of Pooled property in FireDac when accessing a SQLite database?
It's hard to guess what's going on with more details, but are you running Route and BatchLoad multiple times without waiting the first execution to finish (like in a timer, thread, or something like that)? In this case the same batch record might be being processed multiple times, causing some issues in database references.
Also note that by default the native TSQLiteNativeConnectionAdapter doesn't enforce ForeignKeys so maybe if you enable it it will raise the same error as FireDac, so that would not be a problem related to native x FireDac but simply your data is not consistent. (See how to enable foreign keys here: http://www.tmssoftware.com/business/aurelius/doc/web/component_adapters.html)
If that's not the case I can only ask you to provide more info and/or provide a sample project reproducing the problem so we can investigate.
Hello, Thank you for your answer. 
Yes, right, we do that.

In our, an application has both sides which are node and node-server. A node has own thread and a node-server uses a TSpakleTimer on a TDataModule of the main thread.

When I removed the Pooled setting on the node-server side and changed the ForeignKey set False on both nodes then the error does not occur anymore.

Could you give any advice about the following problems, please?

Q1) Can I know the time when finished the execution of Route and BatchLoad? Or can I check it? I don't know how to wait for the finish that.

Q2) I tried the followings but it failed. I was set the flag between the beginning and end of the Route and BatchLoad then checked it. But, I think it does not work, because when the Foreignkey set True, the same error occurred. Can I fix it? or am I missing something?

Q3) If the  Foreignkey set False, the ObjectManager can be do handled it and safe the relations?

Q1) It's a synchronous operation. If the method returns, that it's finished.


Q2) As I said, maybe it's simply that your data is not consistent and is indeed causing foreign key errors. For example you might be trying to import an invoice that points to a customer that simply does not exist in your database. 

Q3) No.
Thank you all for your answers.

Base on your answer, I check the data, and then really I found the not consistent record. Finally, I Fixed it and works fine. 

Thank you very much.