I have come to the conclusion that only 1 client thread can access the server through a connection. But how to manage this?
Do I need to lock the connection every time I use the TSQLConnection. With a Server Method for instance?
How to automate my Server Methods to Lock and Unlock the Connection to my server?
Should i convert all my server method calls From
ServerMethod();
to
Try
Datamodule.lock;
ServerMethod
Finally
Datamodule.unlock;
end;
Or Should I give my Threads New Connections?
I use other threads for printing, this needs information from the server. Printing should be done in the background but stil uses the SQL connection from the main Application.
Edit: The problem with creating a new connection is that the server creates a new ClientSession. So i need to Create and close this Session. Is there a way to create a new connection to the same session?