Re: Accessing multiple databases from same process
Posted in 1997
Dear Daniel, For the most part Informix reads environment variables at program startup time, not each time an SQL statement is executed etc. This can be acheived at least with version 7 using the connect statement, TFM is not bad at explaining this. Though it does depend on what your program is going to do. This allows SQL statements to be executed on the different environments but not things like chunk/dbspace creating etc. Regards, Jason On Tue, 23 Sep 1997 21:36:29 -0500, Daniel Wright <dw420@airmail.net> wrote: > I thought I could accomplish this by setting environment variables >before opening the database. After wasting 15 minutes determining that >Informix failed to supply fgl_putenv() to accompany fgl_getenv(), I >resorted to ESQL/C. However when I tried on Informix 5.??, my first >putenv("TBCONFIG=tbconfig_prd") allowed me to access the production >database (even though I ran the program from development), but after I >closed the database, issued my 2nd putenv("TBCONFIG=tbconfig_dev"), and >then re-opened the database, I was still accessing production. I added >a call to getenv() just to make sure I was really setting the >environment the 2nd time round, which I was. > [I know I did this a couple of years ago, but maybe I used a 2nd >process which set the environment before calling the program which did >the work, I can't remember for sure.] > Confounded by this, I took the program to a machine running Informix >7.2?, changing TBCONFIG to ONCONFIG, and adding DBSERVERNAME, >INFORMIXSERVER, and DBSERVERALIASES, as these seemed to be the relevant >environment variables which changed between databases, but this time, >not even the first round of putenv()s had any affect. > Any idea of what I'm missing? >-- >- Danny Wright >danwright@bigfoot.com >#include <stddisclaimers.h> >Idiot, n.: > A member of a large and powerful tribe whose influence in human >affairs has always been dominant and controlling. > - Ambrose Bierce, "The Devil's Dictionary" > > Jason Harris Informix DBA Westpac Banking Corporation NOTE: I add all these address at the bottom of people who spam me Now when their extractors extract my e-mail address they will also end up spamming each other. wtcjr@ix.netcom.com Shevsky@hotmail.com speech@speechrecognition.com SmartBiz@NevWest.com slender@juice4u.net sbliss@earthfriends.com ron@moneyaction.com removeme@gwh.net rocco@lostvegas.com market@DRAWBRIDGE.NET Foxyrusski@mail-response.com emaster@email-man.com waynesmail@earthlink.net