DB Connection Close

Discussion about recent product features & solutions!
3 posts • Page 1 of 1
slamkwon
Posts:19
Joined: Wed Oct 10, 2018 2:20 am

DB Connection Close

Post by slamkwon »

Hi all,

I am wondering in a performance perspective; what is the best way to deal with DB Connections?
There seems to be two ways in Win CC OA;

1. Create DB connection as soon as panel is open and close once the panel is closed
2. Create DB connection per query and close per query

Is there a guideline with dealing with DB Connections? Is the example provided in help, best practice for DB transactions?

Any insights or specifics would be greatly appreciated!

Thanks

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: DB Connection Close

Post by gschijndel »

Opening a DB connection does not take long, so the performance should not be an issue.
But it really does depends on the usage.
The benefit of opening and closing the connection every time is that the connection does not time out. But if multiple queries are executed in a short time, closing and reopening the connection does not make much sense.

In case clients do not have a direct access to the database a control manager could execute the database actions on behave of the clients.

slamkwon
Posts:19
Joined: Wed Oct 10, 2018 2:20 am

Re: DB Connection Close

Post by slamkwon »

You are absolutely right. It really depends on the use case.

We have resorted to DB pooling to enhance performance.

Thank you very much!

3 posts • Page 1 of 1