Steve Povilaitis wrote:
Yes, O kneebiting supplicant?
Quote:
Is it better/preferred to instantiate one Connection object and then pass
this object to different parts of the client application that need to
execute queries, then close the connection when the application terminates?
Or should one instantiate a new connection object in each method that
executes a query or whatever, then close it when finished? |
Connection establishment takes a fair bit of time, especially if you're
using a database server on a separate machine.
The only good reason to have more than one Connection per process is if
you are using threads, or in some other way multiplexing access to the
database. This is because the MySQL C API does not allow certain
operations to be overlapped. (RTFM for the details.) Other than
threads, there aren't very many sane ways for this to happen.
Quote:
Related, Is it necessary to explicitly call close() on a connection? |
Not in common use. Connection's dtor calls it for you.
This method only exists in case you want to close and then re-establish
the underlying database connection without recreating the Connection object.
Quote:
I'm using the data access object pattern and have a DAO class |
Please provide a reference. The only DAO I know is Microsoft's database
access technology (one of the many they've pushed over the years,
anyway) which wouldn't be on topic here.
Quote:
It appears that I might be overloading the abilities of something, because
my app crashes when the network traffic goes really high and causes a huge
number of calls to my DAO insert() method. |
Is it crashing within MySQL++? If so, can you provide a stack trace?
What platform are you using?
--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw