From: <to...@tu...> - 2016-09-02 10:12:36
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Sep 02, 2016 at 12:20:27PM +0300, Georgios Petasis wrote: > Hi all, > > I want to use a mysql database from multiple threads. What I do right > now, is to load the packages from multiple threads, and use the database > as I would from a single thread. > > The problem is that I am getting errors when beginning transactions. The > errors are about locks, timetouts, etc. [...] Sorry, not really specific to tdbc, but from what I know about other similar interfaces: the database connection has a state, and this state doesn't expect to be "seen" by independent entities (be it threads or whatever). Possible approaches: (1) Set up a separate connection handle for each thread. (2) Use some cunning scheme which somehow manages this state, creating an illusion of a private handle per client (instance). Traditionally this is called "connection pooling" and implemented by having one thread handling the mess on behalf of the others. That said, perhaps ODBC is smarter than I think and pretends to do that for you: then that'd be a bug :-) (Sorry if you knew all of this. Perhaps I just failed to gather that from your question). regards - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlfJS5gACgkQBcgs9XrR2kY+UgCfTUhNOCXk13ZdmgesGftQqqyw mNcAn1G4eCFzGLu0iWgI/GKTOfewvE3L =17kQ -----END PGP SIGNATURE----- |