DB access from multi-threaded application
Posted in 2000
Topics: Server Administration
Has anyone out there tried to access an Informix database from a multi-threaded application server? I understand that this is not possible in Informix Version 5 - since the libraries are not threadsafe. Is it possible under V7? Also, we have been doing multi-threaded access from ORACLE and had to use SQL extensions (involving runtime contexts). Are there any such extensions required for Informix? Thanks, David -- David K. Barker Telephone: [+44] (0)1666 832915 Lucent Technologies, Swindon Road, Malmesbury, Wilts., SN16 9NA, U.K. mailto:dbarker@lucent.com
Yes, I'm currently doing multi-threaded app development on Solaris 2.6. But I have put a mutex around all database calls to avoid some memory leaks. Maybe a later version of the SDK will solve these (esql 9.30.UC1 currently). In article <39816005.790615BB@lucent.com>, David Barker <dbarker@lucent.com> writes >Has anyone out there tried to access an Informix database >from a multi-threaded application server? > >I understand that this is not possible in Informix Version 5 - since >the libraries are not threadsafe. Is it possible under V7? > >Also, we have been doing multi-threaded access from ORACLE and had >to use SQL extensions (involving runtime contexts). Are there any >such extensions required for Informix? > >Thanks, > >David Andrew Lennard andy@kontron.demon.co.uk
David Barker wrote: > > Has anyone out there tried to access an Informix database > from a multi-threaded application server? > > I understand that this is not possible in Informix Version 5 - since > the libraries are not threadsafe. Is it possible under V7? > > Also, we have been doing multi-threaded access from ORACLE and had > to use SQL extensions (involving runtime contexts). Are there any > such extensions required for Informix? Informix ESQL/C is thread safe (just pass the required flags to link in the thread safe libraries) but there are some design issues: o Only one thread at a time can access a particular connection to the server. o You can have multiple threads and multiple connections and the latter can either be dedicated to the former one-to-one or shared between multiple threads as a pool. ESQL provides a mechanism to detach a thread from an open connection and to attach to one without incurring the overhead of shutting down and starting up new connections. o Use mutexes/semaphores and conditions to manage any connection sharing. o Read the ESQL/C manual on the subject. Art S. Kagel