#!C:/perl/bin/perl -w #DBI 1.45 #DBD::ODBC 1.11 use DBI; $dbh = DBI->connect("dbi:ODBC:tmpDB", 'username','password', { PrintError => 1, RaiseError =>0, LongReadLen => 65536, odbc_async_exec => 1, odbc_err_handler => \&errSub } ); $command = qq/ select 'start' select name = 'dbi-user' select 'end' /; $sth = $dbh->prepare($command); die $DBI::errstr unless $sth; my $rc = $sth->execute(); do { my @row; while (@row = $sth->fetchrow_array()) { print join(",", @row), "\n"; } } while ($sth->{odbc_more_results}); $dbh->disconnect; sub errSub { my ($state, $msg) = @_; # Strip out all of the driver ID stuff $msg =~ s/^(\[[\w\s]*\])+//; my $err_text .= $msg."\n"; print "Err($state):",$err_text; }