Informix connection works through Windows, but not through Cygwin - cron

Not really sure where to go with this one. I have a PHP script that invokes a PERL script that connects to an Informix database. This setup works just fine when I run the script to the Windows cmd prompt, but when I attempt to run it through cron in cygwin it fails on
[Informix][Informix ODBC Driver]Unable to load translation shared library (DLL). (SQL-IM009)
I have tried adding the Informix bin directory (/cygdrive/c/Program\ Files\ (x86)/IBM/Informix/Client-SDK/bin) to the PATH variable in the crontab file but there were no changes. I also tried adding that same directory to the INFORMIXDIR variable in the crontab file, but then I got the following error message
[Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101. (SQL-HY000)
If I look that error in finderr.exe (supplied by the driver) I see that it means that it is Unable to load locale categories or my INFORMIXDIR is incorrect, but I am not sure how to set the CLIENT_LOCALE or DB_LOCALE.
Then I think I fixed this by using the correct directory separators and I dropped the bin subdirectory for the INFORMIXDIR variable in crontab, because I got the SQL-IM009 error again.
I am using the Windows PHP and PERL executables in cygwin, so I am not really sure why it wouldn't work as it does if I run it through the cmd prompt. Would anybody know why this is?
I am running this on a Windows Server 2008 R2 cloud instance, and I am attempting to copy a working setup that so that we can move it to an offsite location.

It turns out that cygwin didn't like the directory that the Client-SDK was in. Once I reinstalled it to C:/IBM/Informix/Client-SDK everything started working. I am not sure if the problem was the parentheses or the spaces, but getting them out of the path seemed to do the trick.

Looks more like a problem with using a combo of backslashes and slashes in your PATH environment. Slashes for *nix, backslashes for WIN and DOS. CLIENT, DBLOCALE, DBDATE, etc. can be set in your servernane.cmd file in WIN/DOS and in .profile, .cshrc, .login, etc. depending on the *nix shell you're using. You can install the Informix binaries and other supporting files in any directory you like, as long as INFORMIXDIR environment points to the installed directory. I have 11.70.FC6 installed in C:\INFORMIX and my dbspaces in C:\DBSPACES.

Related

Run "./" bash/batch file with cygwin

Well the idea goes as followed,
I have a bash file for linux, there I obviously run it by making ./my_run.
The problem is I'm in windows so I downloaded and installed cygwin.
I added cygwin bin to the Enviromental Variables and check that at least "ls" works so I guessed I did it well.
When I try to run it with the cmd it displays:
'.' is not recognized as an internal or external command,
operable program or batch file.
As if the cygwin variables were not correctly installed (as I said I tried ls and works).
Then I tried it directly with cygwin and when doing the ./my_run I got it to work right.
So how is that I can use some commands like ls but when doing ./ it doesn't work on the cmd? How can I fix this?
Well, cygwin is only a shared library and a lot of stuff (the programs) using it (read Cygwin doc). cygwin.dll changes internally path resolution / chars to allow you to say ./my_script and converts it to .\my_script before doing the actual windows call, it also adds the proper extension to executables to allow it to execute windows binaries. This magic persists as long as you use it. cmd.exe is a Microsoft Windows command shell that is completely unaware of Cygwin's shared library and by that reason it doesn't use it, so it will not call it for path translation, even if you populate the environment of zetabytes of stuff. When you run in Cygwin terminal, you are running bash shell, which is a Cygwin executable, linked to cygwin.dll. It manages to use Cygwin library for all the unix system call emulations, so when you pass it e.g. to exec("./my_script", ...);, it internally converts that to try for ./my_script, then .\my_script, ./my_script.exe, ... and the same for .com and .bat extensions.
This fact often makes some people to say that Cygwin is not a good, efficient, environment. But the purpose was not to be efficient (and it is, as it caches entries and makes things best to be efficient) but to be compatible.
In your example ls is a Cygwin executable that mimics the /bin/ls executable from unix systems. It uses the Cygwin library, so all path resolution will be properly made (well, under some constraints, as you'll see after some testing) and everything will work fine. But you cannot pretend all your Windows applications to suddenly transform themselves and begin working as if they where in a different environment. This requires some try and error approach that you have to try yourself. And read Cygwin documentation, it is very good and covers everything I've said here.
If you open up Cygwin and run the command there you should be fine.

Can't use "." to execute files with cygwin

I recently installed Cygwin on Windows 8.1, it works great but I can't execute file using the dot, for example "./hello.ml". I'm using the Windows's command prompt.
When I try using it, it show me that "." is not reconized. How can I make it works ?
Thanks.
You need to use the cygwin terminal or powershell instead.
The command interpreter doesn't think that your files are executable because they aren't one of the types that are recognized as binary executables. In general, Windows would use file associations from the registry to make things happen when you try to run a file. The cygwin terminal follows the unix-like convention and knows that your scripts are ml files and they are executable by using the ml interpreter, most likely from a #! at the top of your file.

Cannot run 'phonegap' command on Win 7

I've just installed phonegap on Windows 7, following the instructions on their website. However, whenever I try to run a simple 'phonegap' command, I get the error:
'phonegap' is not recognized as an internal or external command
I put the phonegap path at the enviroment variables 'PATH' but that didn't do anything at all.
I've also made sure WSH was enabled, but still nothing works.
Am I missing something?
It may just be that the path has not been updated (Have you restarted your machine?)
Alternatively, you can copy the path onto the clipboard, then in a cmd window, do the following:
set path=%path%;<Your path here>
Which will include it in your path for the current session only.
Figured this out...I accidenatlly deleted some nodeJS variables while adding ant and java pathes. Had to reinstall node to realize this.

How do i resolve the procedure entry point_impure_ptr error in cygwin/opencobol?

Whenever I try to run my .exe cobol file, i get this error..
fileName.exe Entry Point Not Found
The procedure entry point_impure_ptr could not be located in the dynamic link library cygwin1.dll
I am using OpenCObol and cygwin ver1.7.15.thanks
You'll need to specify the proper path for the command below, but Cygwin seems pretty persnickety with entry point addresses and updates, The system includes a rebaseall command to help fix this problem. Most times I've witnessed it is after a setup.exe pass, while the Cygwin system was still active (and perhaps only in the background and not visible).
C:\Users\btiffin\cygwin\bin\dash -c '/usr/bin/rebaseall'
Run that from a Windows CMD shell (while Cygwin isn't active, say after a clean boot and before running the Cygwin shell. Basically cygwin1.dll can't be open). You'll need to use the proper Windows path to dash for your particular install. Google Cygwin rebase for detailed articles.
I had a similar error message after upgrading from cygwin version 1.5 to 1.7. I solved it by completely removing and reinstalling 1.7 from scratch. I was told there might have been a problem with multiple versions of dlls.

Environment Variable not being passed to CruiseControl, specifically the 'nodosfilewarnings' ENV variable from Cygwin

I have a Perl program that someone else created and I am calling on with CruiseControl. The program calls on Unix Commands using Cygwin. However, everytime that the Perl program calls on a Unix like command with a DOS like address, I get the well known error:
cygwin warning:
MS-DOS style path detected: E:\regression
Preferred POSIX equivalent is: /cygdrive/e/regression
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
I have set both the User Variable AND System Variable CYGWIN to nodosfilewarning. This removes the error when I run the program from the command line, but the error still occurs in CruiseControl when called as an automated process from a batch file. I have called on both the batch file from the Desktop AND Command Line and ran as an administrator. Nothing changes.
Other Notes
For purposes of this problem, I don't have access to the Perl Program
I am trying to go back to Cygwin 1.5.*, but since I am using Server 2008, I am encountering compatibility issues
This is occurring on one of the distributed servers, not the main server running the Webdashboard.
I have read somewhere that this issue may stem from a different user calling on CruiseControl, but the issue should have been solved by setting this as an ENV System variable
Is it possible to modify the registery to set the ENV variables?
Thank you in advance
The way I do it is like this
printf 'export CYGWIN=nodosfilewarning' >> ~/.bash_profile
If CruiseControl is connecting to the server via ssh, reinstall sshd and explicitly include nodosfilewarning when prompted for the CYGWIN environment variable during the install.
Re-installing with modified environment will work but if you don't want to or cannot re-install, an alternative is to change the registry instead of re-installing the service.
See: CYGWIN windows cygrunsrv sshd server and MS-DOS style path detected

Resources