Re: The Next INFORMIX party Was: Update on C.D.I gatherings....
Posted in 1996
>
> Binh Thanh Nguyen (nbt@CERF.NET) wrote:
> : Dear all,
>
> : Have anyone any success with using PERL-5 DBI Informix module on Infx 7.x
> : to remote database ? Please share your experience.
>
> <snip>
>
> : Perl 5.0 Informix DBI works well locally (on local server)...as some of
> : you might already know from ztools.
>
> Is ztools really using DBI, or are they just parsing output from dbschema
> and dbaccess? I wasn't aware that perl 5 was yet capable of direct Informix
> access. ISQLPERL is only available on perl4.
>
> If someone actually is using perl5 with Informix, please post something showing
> where we can get all the pieces.
>
> Joe
Hi Joe,
You are correct on the point that ztools does not use Informix DBI.
Anyway, Here is what I have for Perl5 & Informix on my system.
Solaris 2.5 on Sparc20, Perl5.002, Informix Online 7.13UC1
-----------------------------------------------------------
Download and Install:
- DBI-0.70.tar.gz (Tim Bruce Perl5 Database Interface)
( http://www.hermetica.com/technologia/DBI ) Alpha release
- DBD-Informix-0.20pl1.tar (Informix Database Driver) Alpha Release
- I modify test.pl and test2.pl from the distribution...
- Please note that $dbhost, $dbuser, $dbpass are unused at this moment !.
you can put anything there and it will work. Store7 is the database
that must exist to use with this test.
---------------------------------------------------------------------------
test2.pl
#!/usr/local/bin/perl
BEGIN{unshift @INC, "../../lib", "./lib";}
use DBI;
$testtable = "testaa";
$dbname = 'stores7';
$dbhost = 'xxx';
$dbuser = 'xxx';
$dbpass = 'xxx';
print "Testing: DBI->install_driver( 'Informix' ): ";
( $drh = DBI->install_driver( 'Informix' ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Testing: \\$drh->connect( $dbhost, $dbname, $dbuser, $dbpass ): ";
( $dbh = $drh->connect( $dbhost, $dbname, $dbuser, $dbpass ) )
and print("ok\\n")
or die "not ok: $DBI::errstr\\n";
print "Testing: \\$dbh->disconnect(): ";
( $dbh->disconnect )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Re-testing: \\$drh->connect( $dbhost, $dbname, $dbuser, $dbpass ): ";
( $dbh = $drh->connect( $dbhost, $dbname, $dbuser, $dbpass ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print STDERR "*** Testing: \\$dbh->do FUNCTION: Just ignore: \\n
Statement handle DBI::st=HASH(0x80dedf0) destroyed without
finish()\\n\\n errors ***\\n";
print "Testing: \\$dbh->do( 'CREATE TABLE $testtable
(
id INTEGER,
name CHAR(64)
)' ): ";
( $dbh->do( "CREATE TABLE $testtable ( id INTEGER, name CHAR(64) )" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Testing: \\$dbh->do( 'DROP TABLE $testtable' ): ";
( $dbh->do( "DROP TABLE $testtable" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Re-testing: \\$dbh->do( 'CREATE TABLE $testtable
(
id INTEGER,
name CHAR(64)
)' ): ";
( $dbh->do( "CREATE TABLE $testtable ( id INTEGER, name CHAR(64) )" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
# List the fields of the table we've just created in here.....
#print "Testing: \\$dbh->func( $testtable, '_ListFields' ): ";
#( $ref = $dbh->func( $testtable, '_ListFields' ) )
# and print( "ok\\n" )
# or die "not ok: $DBI::errstr\\n";
# List the fields. Uncomment this if you're the curious type........
print "Testing: \\$dbh->do( 'INSERT INTO $testtable VALUES ( 1, 'Alligator
Descartes
' )' ): ";
( $dbh->do( "INSERT INTO $testtable VALUES( 1, 'Alligator Descartes' )" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Testing: \\$dbh->do( 'DELETE FROM $testtable WHERE id = 1' ): ";
( $dbh->do( "DELETE FROM $testtable WHERE id = 1" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Testing: \\$cursor = \\$dbh->prepare( 'SELECT FROM $testtable WHERE
id = 1' ):
";
( $cursor = $dbh->prepare( "SELECT * FROM $testtable WHERE id = 1" ) )
and print( "ok\\n" )
or print( "not ok: $DBI::errstr\\n" );
print "Testing: \\$cursor->execute: ";
( $cursor->execute )
and print( "ok\\n" )
or print( "not ok: $DBI::errstr\\n" );
print "*** Expect this test to fail with NO error message!\\n";
print "Testing: \\$cursor->fetchrow: ";
( @row = $cursor->fetchrow )
and print( "ok: $row\\n" )
or print( "not ok: $DBI::errstr\\n" );
print "Testing: \\$cursor->finish: ";
( $cursor->finish )
and print( "ok\\n" )
or print( "not ok: $DBI::errstr\\n" );
# Temporary bug-plug
undef $cursor;
print "Re-testing: \\$dbh->do( 'INSERT INTO $testtable VALUES ( 1,
'Alligator Descar
tes' )' ): ";
( $dbh->do( "INSERT INTO $testtable VALUES( 1, 'Alligator Descartes' )" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Re-testing: \\$cursor = \\$dbh->prepare( 'SELECT FROM $testtable
WHERE id = 1'
): ";
( $cursor = $dbh->prepare( "SELECT * FROM $testtable WHERE id = 1" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
#print "Rows returned should be: 1\\nActual rows returned: $numrows\\n";
print "Re-testing: \\$cursor->execute: ";
( $cursor->execute )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Re-testing: \\$cursor->fetchrow: ";
( @row = $cursor->fetchrow )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Re-testing: \\$cursor->finish: ";
( $cursor->finish )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
# Temporary bug-plug
undef $cursor;
print "Testing: \\$dbh->do( 'UPDATE $testtable SET id = 2 WHERE name =
'Alligator De
scartes'' ): ";
( $dbh->do( "UPDATE $testtable SET id = 2 WHERE name = 'Alligator
Descartes'" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "Re-testing: \\$dbh->do( 'DROP TABLE $testtable' ): ";
( $dbh->do( "DROP TABLE $testtable" ) )
and print( "ok\\n" )
or die "not ok: $DBI::errstr\\n";
print "*** Testing of