Help: Sharing one connection in I-NET for Windows.
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hello, We have Informix Online 5.00 on IBM/AIX and ESQL/C with I-NET 5.01.WD1 for Window 3.1. On my PC, I created a DLL which contains functions to connect/disconnect to DB server, and to execute Dynamic-SQL statements. My applictions will call this DLL to make a connection and execute some dynamic-SQL statements. Inside the DLL, I keep a counter to indicate if connection is made. I want all applications shareing one connection to a single database server. My question is how to use GetConnect(), SetConnect(), and $database inside one DLL to achieve this? What I am doing right now is: When application program call the DLL to connect to the server, the DLL will check if the connect is made, if not, it will call GetConnect() and set the counter. Otherwise, it doing nothing, or call SetConnect(), I have tried both. It works fine if there is only one application running. But with two applications running at same time, when the second one call the DLL to execute first Dynamic SQL statement, it will get error 457, "database server terminated unexpectedly". The first one will also get same error. Does anyone have any idea what's wrong with my way of doing this? and how to share one connection with one DLL? On the I-ESQL/C for Windows Programmer's Manual 5.0, it says multiple application can share one connection, but I couldn't find any example showing how to do it. Also it mentions, in their scenario, "APP1 would have to let APP2 know the connection information required to set the connection appropriately in APP2." But what information does APP2 need to know from APP1 to "set connection appropriately"? I love Informix manual. Thanks, -- John Ru E-mail: john@magna.com