Re: Problem with PERL and DBD::Informix strict refs
Posted in 2003
Jonathan, Tim, Thank you very much for your help. We did change the check_table.pl script. Below is the cut from the check_table.pl script and it worked well. ############################################################################ # Install Informix dbase driver. ############################################################################ # The below line was commented on 6/12/2003 # $driver_handle=DBI->install_driver('Informix'); ############################################################################ # Open Dbase connection ############################################################################ # The below line was commented on 6/12/2003 # $database_handle=$driver_handle->connect("$databasename", "", "", 'Informix') || die ("FAILED attempting CONNECTION to $INFORMIXSERVER databasename. \\n"); ############################################################### # New database connection...The below line was added on 6/12/2003 $database_handle=DBI->connect("dbi:Informix:$databasename"); Thank you Chavan ----- Original Message ----- From: "Jonathan Leffler" <jleffler@earthlink.net> To: "Chavan Koya" <chavankoya189@hotmail.com> Cc: "Tim Bunce" <Tim.Bunce@pobox.com>; "Informix Mailing List" <informix-list@iiug.org> Sent: Tuesday, June 10, 2003 11:22 PM Subject: Re: Problem with PERL and DBD::Informix strict refs > Chavan Koya wrote: > > Jonathan, > > Thank you very much for your time and response. > > > > Here with i am sending the logs, check_table.pl > > The information is there, but it is one level more devious than I > expected. The code does: > > $driver_handle=DBI->install_driver('Informix'); > # Comment deleted > $database_handle=$driver_handle->connect("$databasename", "", "", > 'Informix') || die ("FAILED attempting CONNECTION to $INFORMIXSERVER > $databasename. \\n"); > > > This is another alternative way (a deprecated way in general) of writing: > > $database_handle = DBI->connect("$databasename","","","Informix") || > die ... > > Which is, indeed, the basic problem I diagnosed. > > Replace the lines in your current code with: > > $database_handle = DBI->connect("dbi:Informix:$databasename","","", > {PrintError => 1}) || > die "Failed to connect to $databasename\\@$INFORMIXSERVER"; > > This is essentially equivalent to your code, minus the bug. Well, > mostly - the PrintError attribute in the hash ref means that DBI will > get to print the DBD::Informix version of the error, as well as your > code handling the errors in its own way. > > > > > ************************************************************* > > * ERROR > > ************************************************************* > > file_ld.sh: Calling /project1/lbin/check_table.pl stg1_shm ccrd_calling_card > > ccrd_corp_rev_hdtr file_nm > > /output1/ccrd/corp_rev/log/corp_rev_initial_filelist.txt > > /output1/ccrd/corp_rev/log/corp_rev_final_filelist.txt FAILED > > file_ld.sh: ct_return = Can't use string ("Informix") as a HASH ref while > > "strict refs" in use at > > /opt/perl5/lib/site_perl/5.8.0/PA-RISC2.0-LP64/DBD/Informix.pm line 146. > > file_ld.sh: exit status = 255 > > > Tim - I'm guessing that the mapping from old to new connect syntax is > bypassed by the use of $dbh->connect() in place of DBI->connect. Is > that something that DBI can handle, or is it just an inevitable > consequence of the old method of loading and connecting? > > >>Send code - it is impossible to debug your without it. And I mean the > >>check_table code. > >> > >> > >>Also, I need the versions of: Perl (ok - that's 5.8.0), DBI, > >>DBD::Informix (ok - that's 1.04.PC1, but why not v2003.04), ESQL/C or > >>CSDK - as noted in the documentation. Try: perldoc DBD::Informix. > >>Also look at the BugReport script, and perldoc DBD::Informix::TechSupport. > >> > >>Did your script work previously? Under Perl 5.8.0? Unchanged? > >> > >>I wonder if you are using the archaic version of DBI->connect? > >> > >>$dbh = DBI->connect('dbase', 'user', 'pass', 'Informix'); > >> > >>The modern version is: > >> > >>$dbh = DBI->connect('dbi:Informix:dbase', 'user', 'pass', { RaiseError > >>=> 1}); > >> > >>That fourth argument is a hash reference - you might be passing > >>'Informix' as the value, in which case, a string will be used as a > >>hash reference - hence the error you are seeing. > >> > >>Having thought of it, I'd be surprised if that is not your problem. > >> > >>perldoc DBI DBD::Informix > > > > > -- > Jonathan Leffler (jleffler@earthlink.net, jleffler@us.ibm.com) > #include <disclaimer.h> > Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/ > >