esqlc prepared stmt for multiple connections?
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, With ESQL/C in Client SDK 2.20, can I prepare a statement once, and then use it in other connections? In other words, is it possible to prepare a statement with one connection active, and then execute the statement with another connection active? Regards, Per -- * Per Frykenvall mailto:per.frykenvall@got.wmdata.se * * WM-data Applikationslosningar AB Fax: +46-31-733 12 00 * * Box 14383, SE-400 20 GOTEBORG, Sweden Voice: +46-31-733 12 11 *
Per Frykenvall wrote: > With ESQL/C in Client SDK 2.20, can I prepare a statement once, > and then use it in other connections? In other words, is it > possible to prepare a statement with one connection active, > and then execute the statement with another connection active? No. Think about it a bit. Connection 1 could be to SE on MachineA, Connection 2 could be to IIF.2000 on MachineB. How would the SE engine get to know about a statement prepared by IIF.2000? Statements are prepared on/for a specific connection, and can only be used by that connection. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>
No. Prepared statements are only known to a single session and each connection represents a separate session. HOWEVER, know that IDS.2000 has implemented a prepared statement cache so that if a statement is similar enough to another already in the cache the optimizer will co-opt that statement's query plan rather than develop a new one. We have been asking for this feature for years. The big O has had it for a long time, though it does not work well there but Informix tends to do everything better than they do anyway, so I am hopeful. Anyway this new feature would reduce the query plan development phase of statement preparation tremendously for commonly used statements. Especially in environments like ours, and apparently yours as well, where we have many middleware server sessions preparing the same statements. Art S. Kagel Per Frykenvall wrote: > > Hi, > With ESQL/C in Client SDK 2.20, can I prepare a statement once, and then > use it in other connections? In other words, is it possible to prepare a > statement with one connection active, and then execute the statement > with another connection active? > Regards, > Per > > -- > * Per Frykenvall mailto:per.frykenvall@got.wmdata.se * > * WM-data Applikationslosningar AB Fax: +46-31-733 12 00 * > * Box 14383, SE-400 20 GOTEBORG, Sweden Voice: +46-31-733 12 11 *