DB Open Connection and Close Connection

Find and share HowTos to various installations / configurations!
Search

Post Reply
2 posts • Page 1 of 1
slamkwon
Posts: 19
Joined: Wed Oct 10, 2018 2:20 am

DB Open Connection and Close Connection

Post by slamkwon »

string SqlPath = "DSN=ORA;UID=TEST;PWD=TEST1234;";

I would like to 'dbOpenConnection' in Main() and 'dbCloseConnection' when WINCCOA itself is shutting down.

1. Where do I use 'dbCloseConnection' tp achieve this?
2. Is there a way to check the status of the dbConnection variable Open and Close?

The following script runs more than 100,000 times a day, so there is a great load on the Oracle server as for every "dbOpenConnection" a "dbCloseConnection is looped for every single operation.


bool SQL WORK(string SqlPath,dbConnnection &Local_db) {
int nResult = 0;

//SQL OPEN
nResult = dbOpenConnection(SqlPath, Local_db);

////WORK
////WORK

//SQL CLOSE
dbCloseConnection (Local_db);
}

User avatar
mkoller
Posts: 741
Joined: Fri Sep 17, 2010 9:03 am

Re: DB Open Connection and Close Connection

Post by mkoller »

I'd say you don't need to close the connection explicitely since it will be done automatically when the CTRL manager stops the script.

However if you like to do any other task when the CTRL manager shuts down, then - with 3.16 - you can register a callback
with sysConnect("callback", "exitRequested");

Post Reply
2 posts • Page 1 of 1