Two part question,
Should a single global connection object in a module be used for the life of the application rather then a ton of local connections?
And if so, should the connection.state remain open or constantly be re-opened & closed after each query?
I'm running an app that will have very few users connected to this specific database. So room for connection pooling shouldnt be an issue.
Speed is priority in the program, the individual queries will be small; return a few records; update the record(s) and print a report.
Although each query is rather of small; this will be done tens of thousands per day. So returning the record(s), updating and sending to the printer as fast as possibile is priority.
I know that it is recommended to use local connection obects and to open & close the objects as fast as possibile. But this does seem to conflict with the time & resources it takes to keep re-creating objects and establishing new connections.
I think it would be faster to have one global connection that remains open even though it seems not to be the recommended way.
Looking for a detailed response to the pro's and cons of both ways.
Should a single global connection object in a module be used for the life of the application rather then a ton of local connections?
And if so, should the connection.state remain open or constantly be re-opened & closed after each query?
I'm running an app that will have very few users connected to this specific database. So room for connection pooling shouldnt be an issue.
Speed is priority in the program, the individual queries will be small; return a few records; update the record(s) and print a report.
Although each query is rather of small; this will be done tens of thousands per day. So returning the record(s), updating and sending to the printer as fast as possibile is priority.
I know that it is recommended to use local connection obects and to open & close the objects as fast as possibile. But this does seem to conflict with the time & resources it takes to keep re-creating objects and establishing new connections.
I think it would be faster to have one global connection that remains open even though it seems not to be the recommended way.
Looking for a detailed response to the pro's and cons of both ways.