开发者

DBD::Informix connection issues

I'm having somewhat weird problem with DBD::Informix. If I run a simple script like that:

use DBI;
my $dbh = DBI->connect_cached('dbi:Informix:database', '', '');
my $sth = $dbh->prepare('select foo from bar');
...

It works all right. But if I try to do exactly the same from a test script it fails with the following message:

SQL: -25588: The appl process cannot connect to the database server cms_ol.
ISAM: 22: Invalid argument

The only difference I see is that test script is quite heavy on module usage; it is based on Test::More and loads a lot of submodules that are to be tested.

Turning on DBI trace does not provide anything useful (for me, at least). Simple script runs along just fine:

DBI 1.616-nothread default trace level set to 0x0/1 (pid 9685 pi 0) at test_ifx.pl line 6
Note: perl is running without the recommended perl -w option
-> DBI->connect(dbi:Informix:cms@cms_ol, , ****, HASH(0x13fad0))
-> DBI->install_driver(Informix) for solaris perl=5.008009 pid=9685 ruid=106 euid=106
   install_driver: DBD::Informix version 2011.0612 loaded from /cms/webdash/lib/arch/DBD/Informix.pm
<- install_driver= DBI::dr=HASH(0x1c8070)
!! warn: 0 CLEARED by call to connect method
    -->> DBD::Informix::dbd_ix_db_connect()
CONNECT TO 'cms@cms_ol' - no user info
    -->> DBD::Informix::dbd_ix_db_check_for_autocommit()

... and the only difference in trace of the problematic script I see is that it just fails:

DBI 1.616-nothread default trace level set to 0x0/1 (pid 9687 pi 0) at 22_report.t line 5 via 22_report.t line 6
Note: perl is running without the recommended perl -w option
-> DBI->connect_cached(dbi:Informix:cms, , ****)
-> DBI->install_driver(Informix) for solaris perl=5.008009 pid=9687 ruid=106 euid=106
   install_driver: DBD::Informix version 2011.0612 loaded from /cms/webdash/lib/arch/DBD/Informix.pm
<- install_driver= DBI::dr=HASH(0xb619bc)
!! warn: 0 CLEARED by call to connect_cached method
    -->> DBD::Informix::dbd_ix_db_connect()
CONNECT TO 'cms' - no user info
***ERROR***
SQL: -25588: The appl process cannot connect to the database server cms_ol.
ISAM: 22: Invalid argument
    <<-- dbd_ix_db_connect (**ERROR-1**)
    <<-- DBD::Informix::dbd_ix_db_connect()

I'm running custom Perl 5.8.9 build in Solaris 9, with latest DBI and DBD::Informix versions, against Informix IDS 9.40UC.

Update: If I try to be a smartass and put a 开发者_运维百科block like that at the top of the heavy test script:

use DBI;
BEGIN { my $dbh = DBI->connect_cached( ... ); print "Connected!\n" if $dbh; }

... it prints like this:

Connected!
Out of memory!
Callback called exit.
END failed--call queue aborted at t/22_report.t line 20.
Callback called exit at t/22_report.t line 20.
BEGIN failed--compilation aborted at t/22_report.t line 24.

My guess is that DBD::Informix conflicts with some of the modules loaded after the connection is made. But which one? That's the question...

Another update: It appears that the above trick does something unwieldy. I tried to load all the modules explicitly by replacing 'use Module' with 'require Module; Module->import'. Pure Perl modules are OK but whenever XS module using XSLoader appears, Perl goes boom with friendly 'Out of memory' message. And if I move Informix connection below module initialization, it works all right - except DBD::Informix fails with the same -25588 error. Boomer. I'm at loss. :(

Another another update: I tried to run the same script with standard Perl 5.6.1 shipped with Solaris 9, using DBI 1.601 (the latest that would compile with Perl 5.6) and DBD::Informix 2011.0612. Same thing, so it's not custom Perl giving me trouble.

I can also add that the test module in question was prototyped using DBD::SQLite and fully works. It is the final test with DBD::Informix that is failing... As usual. :/

Workaround: following e-mail discussion with Jonathan, a workaround was found: addition of streams-based 'onipcstr' connection to Informix server allowed DBD::Informix to connect. Apparently, some XS modules interfere with default shmem-based connection method, although the culprit is unknown at the moment.


Further discussion

Custom-built Perl is, in my experience, easier than the system Perl. I never modify the system's Perl installation (I don't want to break it) so I always build my own.

You appear to have:

  • Solaris 9 (SPARC?)
  • Perl 5.8.9
  • DBI 1.616
  • DBD::Informix 2011.0612
  • ESQL/C (CSDK) 2.81
  • Informix Dynamic Server 9.40

We don't have the detailed sub-version of ESQL/C and IDS (2.81.UC2, 9.40.UC5, or whatever). There's a hint that you are using a 32-bit version of IDS, so probably everything is 32-bit. You are probably aware that 9.40 is no longer supported by IBM (and, indeed, its successor version 10.00 is also out of support). However, superficially, none of that should matter very much. The failing t91lvarchar.t is not a big issue.

  • Can you run the connect in working and non-working modes with DBI_TRACE=9 set in the environment.

If the trace for the connect operation is too voluminous to go into an update to the question, we'd better take this off-line to the DBD::Informix support channels (that's me, but by email).

The 'ISAM' error of 22 (Invalid argument) is puzzling. I'm curious about what is in your sqlhosts file for this server - the entry for cms_ol specifically. I'm not sure it will reveal anything, not least because you say the sample ESQL/C below (in the 'First hypothesis' section) works OK, and sometimes the Perl connects and sometimes it does not.

I wonder if there is a name conflict somewhere between functions in the shared libraries? That sort of thing will be hell to track.

First hypothesis

Further information received shows that this was not the crucial distinction.

The difference appears to be:

  • Works: CONNECT TO 'cms@cms_ol' - no user info
  • Fails: CONNECT TO 'cms' - no user info

The tricky part to explain is why the second fails, especially as the error goes on to mention cms_ol.

The workaround is to specify the server name in the connect string:

  • DBI->connect(dbi:Informix:cms@cms_ol, , ****, HASH(0x13fad0))
  • DBI->connect_cached(dbi:Informix:cms, , ****)

The underlying problem is more likely at the ESQL/C level than anything to do with other Perl modules. That is, if you compiled and executed this ESQL/C program, it would fail on cms and work on cms@cms_ol:

int main(int argc, char **argv)
{
    $ char *dbs = "cms";
    if (argc > 1)
        dbs = argv[1];
    $ whenever error stop;
    $ connect to :dbs;
    return 0;
}

You could run it without an explicit database name (or with an explicit 'cms'), and I would expect it to fail. You could run it with 'cms@cms_ol' and I would expect it to pass. The program will say nothing if it passes; it will be obvious when it fails (though the messages will not be beautiful).

There is an outside chance it is something to do with connect_cached; that is a service provided by the DBI module and not by the DBD::Informix module. On the whole though, it is more likely something happening at the ESQL/C level.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜