running ESQL/C programs from startup scripts
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Internationalization & Character Sets
I hope someone has a simple answer for this one... We have written a few client programs in ESQL/C for our Unixware 7 server running Informix SE 7.2x. These client programs will be running locally on the box. When executed from the command line, they work just fine. However, when you place them in a shell script (startup or otherwise), the programs cannot open the database, and give back an error "unable to load locale categories [-461]". We suspected the environment wasn't set up right, but they still do this even when we put all the environment variables we can think of into our script. The error number suggests that a file cannot be found or permissions on the file are not correct. This seems strange, because the behaviour persists even when the script is in the same directory as the program and is run by the same user. Are we missing something obvious? I don't think having to manually execute a bunch of programs on startup and at periodic intervals would go over well. As things stand now, we can't use them in rc.d files or cron jobs because of this problem. Thank you in advance for any help you have to offer... Mark Hayden.
Mark Hayden wrote: > > I hope someone has a simple answer for this one... > > We have written a few client programs in ESQL/C for our Unixware 7 > server running Informix SE 7.2x. These client programs will be running > locally on the box. When executed from the command line, they work just > fine. However, when you place them in a shell script (startup or > otherwise), the programs cannot open the database, and give back an > error "unable to load locale categories [-461]". > > We suspected the environment wasn't set up right, but they still do this > even when we put all the environment variables we can think of into our > script. The error number suggests that a file cannot be found or > permissions on the file are not correct. This seems strange, because > the behaviour persists even when the script is in the same directory as > the program and is run by the same user. > > Are we missing something obvious? I don't think having to manually > execute a bunch of programs on startup and at periodic intervals would > go over well. As things stand now, we can't use them in rc.d files or > cron jobs because of this problem. SQL Error -461 is listed as File open error. This statement transfers a value between a file and a BYTE or TEXT coumn.... If you are not doing this then I KNOW your problem. It is definitely environment related. It happens when you try to run an ESQL 7.xx compiled applications while in a OL5.xx environment. I suspect that you once ran 5.xx and that directory structure still exists and more that /etc/profile sets the environment for that by default. You MUST set and export te following variables in each script that is run out of the rc directories or crontab: INFORMIXSERVER INFORMIXDIR In addition if the server is local and you are using shared memory set and export: ONCONFIG If the sqlhosts file is not named sqlhosts set and export: SQLHOSTS If the sqlhosts file does not reside in $INFORMIXDIR/etc set and export: INFORMIXSQLHOSTS Looks like you set the variables but did not export them, by default bot startup scripts and crontab scripts use Bourne shell (/bin/sh) which does not automatically re-export modified variables as Korn shell (ksh) and Born Again SHell (bash) do. Art S. Kagel