Frequently Asked Questions for Informix Database Driver for Perl Version 0.97005 (2000-02-10)

1.  My program works OK when I run it from the command line but fails when
    I run it via a web server (CGI, mod_perl, etc).

    The answer is the environment - almost invariably.

    You should establish exactly what the environment is when your script
    is run, using some surrogate for your real script that uses DBI and
    DBD::Informix.  Then you will have to work out how to set the
    INFORMIXDIR, INFORMIXSERVER and LD_LIBRARY_PATH environment variables
    properly.  With Apache, this is usually the SetEnv directive (possibly
    PassEnv instead).  Other web servers will have equivalents.  You could
    also consider trying to set the environment in a BEGIN block, but it
    may well set the environment too late to be useful.

2.  In the following code, I get error -280 (a quoted string exceeds 256
    bytes) when the value of $longcharstring contains more than 256
    characters.  This is odd because LongCharCol is defined to contain
    many more than 256 characters (eg CHAR(2500)).

        $sql = "INSERT INTO SomeTable(LongCharCol) VALUES('$longcharstring')";
        my $sth = $dbh->prepare($sql) or die($DBI::errstr);
        $sth->execute() or dir($DBI::errstr)

    ESQL/C has an irritating limitation that the longest character
    literal that it allows is 256 characters long.  There's a simple
    workaround which always works; use a place-holder in place of the
    string.  This has the additional advantage of not breaking when the
    $longcharstring variable itself contains quote characters, whereas
    the example code will break.

        $sql = "INSERT INTO SomeTable(LongCharCol) VALUES(?)";
        my $sth = $dbh->prepare($sql) or die($DBI::errstr);
        $sth->execute($longcharstring) or dir($DBI::errstr)

3.  Where can I find documentation on Informix?

    At the Informix web-site: http://www.informix.com/answers

4.  When I try to build the shared library, I get an error message about
    lots of missing symbols like Perl_newAV (referenced in dbdattr.o)
    and Perl_newSV (referenced in Informix.o) and main.  What's up?

    This most frequently occurs when you need to modify the esql script
    to change the default compiler from cc to (typically) gcc, and you
    don't respect the INFORMIXC environment variable.  At the start of
    the original esql script is a line that reads:

        CC=${INFORMIXC=cc}                  # Original version

    If you need to change that to use gcc by default, then modify it to
    keep the option of overriding the C compiler with the INFORMIXC
    environment variable, because DBD::Informix uses INFORMIXC to ensure
    that it can build the shared library on many systems (specifically,
    this is necessary on Solaris 2.6, Solaris 7 and Linux; it will be
    necessary on many SVR4-derived systems).

        CC=${INFORMIXC=gcc}                 # Correct change
        CC=${INFORMIXC=/usr/local/bin/gcc}  # Correct change

        CC=gcc                              # Incorrect change
        CC=/usr/local/bin/gcc               # Incorrect change

    Why?  On these platforms, the -G option needs to be relayed to the C
    compiler or loader, but the esql script thinks that -G is an option
    intended for its own benefit.  So, to get the -G option to the C
    compiler, it is set in the ESQLLD environment variable, and
    INFORMIXC is set to run the esqlld Perl script.  If you modify esql
    to ignore INFORMIXC, you make it ignore a lot of hard work -- and
    cause the build to fail.

@(#)$Id: Notes/Informix.faq version /main/6 2000-02-08 10:41:28 $
