Forgotten database (Informix + C++ + Netscape + Shared Libs = Trouble)
Posted in 1996
Topics: Installation, Setup & Upgrades, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
I am trying to adopt an existing application, written in C++, into a dynamically loadable .so library, for use as a module in Netscape:s Commerce Server under Solaris. This application works against an Informix database, using ESQL/C. This means that I am trying to do this transformation: +-------------------------------+ +------------------------+ | | | | | C Interface against Netscape | | | | | | | +-------------------------------+ | | | | | | | C++ Application | | | | | | | +-------------------------------+ | Solaris-style | | | ==> | shared library | | C interface against ESQL/C | | (.so-file) | | | | | +-------------------------------+ | | | | | | | ESQL/C code | | | +-------------------------------+ | | | | +-------------------------------+ | | | Informix's ESQL libraries | | | +-------------------------------+ +------------------------+ I manage to get everything to link and to load correctly into the Netscape server, but when I run it, my application seems to forget its database. I manage to open it, using in this in Informix 5.05: int open_database(const char *nam) { $char *name = (char*)nam; /* no const in esql/c */ $database $name; $set isolation to repeatable read; $set lock mode to wait 15; return (SQLCODE != 0); } which returns OK, but when I try to do a select, I get this error: Informix SQL error code -349 Informix error message: Database not selected yet. So I figure I have to upgrade to Informix 7.11, making the open-database-code: int open_database(const char *nam) { $char *name = (char*)nam; /* no const in esql/c */ $connect to $name; $set isolation to repeatable read; $set lock mode to wait 15; return (SQLCODE != 0); } But I still get error -349. I then change the Netscape interface code into an ordinary main(), turning my shared library back into an application, and my selects starts to work again... Anyome who can figure this out for me? The .so file was built using: gcc -L [application-specific lib dirs ] \\ -o libns.so -G \\ [ application .o files ] \\ -l [application specific libs ] \\ -liostream -lsocket -lnsl \\ /arch/informix7/lib/esql/libsql.a \\ /arch/informix7/lib/libasf.a \\ /arch/informix7/lib/esql/libgen.a \\ /arch/informix7/lib/esql/libos.a \\ -lm -ldl I am using: gcc version 2.7.2 INFORMIX-ESQL Version 7.11.UC1 SunOS 5.5 Netscape Commerce Server Version 1.12 Unix Export -- _ Mats Ohrman E-mail: matoh@lysator.liu.se