The driver manager I need to use is provided by DataDirect.

The SqlServer test fails too:
        bash-2.01# make test
        PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" 
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
        t/01base.........ok
        t/02simple.......dubious
                Test returned status -1 (wstat 139, 0x8b)
                test program seems to have generated a core
        DIED. FAILED tests 19-21
                Failed 3/21 tests, 85.71% okay
        t/03dbatt........ok
        t/05meth.........ok
        t/07bind.........ok
        t/08bind2........ok
        t/09multi........ok
        t/20SqlServer....FAILED test 27
          Failed 1/28 tests, 96.43% okay
        t/30Oracle.......skipped
          all skipped: Oracle tests not supported using Microsoft SQL Server
        Failed Test     Stat Wstat Total Fail  Failed  List of Failed
        -------------------------------------------------------------------------------
        t/02simple.t      -1   139    21    6  28.57%  19-21
        t/20SqlServer.t               28    1   3.57%  27
        1 test skipped.
        Failed 2/9 test scripts, 77.78% okay. 4/96 subtests failed, 95.83% okay.
        make: *** [test_dynamic] Error 2

The test 27 is not ok:
        ok 23
        ok 24
        odbc_async_exec is: 1
        ok 25
        ===> state: 01000 msg: Trace option(s) not enabled for this connection. Use 
'DBCC TRACEON()'. nativeerr: 7941
        ===> state: 01000 msg: DBCC execution completed. If DBCC printed error 
messages, contact your system administrator. nativeerr: 2528
        ok 26
        ===> state: 42S02 msg: Invalid object name 'perl_dbd_table1'. nativeerr: 208
        ===> state: 42S02 msg: Invalid object name 'perl_dbd_table1'. nativeerr: 208
        not ok 27
        imp_drh is defined
        ok 28



Based on the suggestions, I saw several things by modifying the 02simple.t:

The failing test on it's own is
        use DBI;
        my $dbh3 = DBI->connect("unexistingx", "whateverlogin", "whateverpassword", 
{RaiseError=>0, PrintError=>0});
        print "Test Ok if Errstr not undef: " . $DBI::errstr . "\n";
and runs fine.


3) I trimed down the test script to the minimum I could:
        $| = 1;
        use DBI qw(:sql_types);
        use ODBCTEST;

        print " Test 2: connecting to the database\n";
        my $dbh = DBI->connect() || die "Connect failed: $DBI::errstr\n";
        $dbh->{AutoCommit} = 1;

        my $rc = ODBCTEST::tab_create($dbh);
        $rc = ODBCTEST::tab_insert($dbh);
        $rc = select_long($dbh);
        $rc = ODBCTEST::tab_delete($dbh);

        {
                my $dbh2 = DBI->connect();
                $dbh2->disconnect;
        }

        {
                print " Test 19: test connection success when DBI DSN is invalid\n";
                my $dbh3 = DBI->connect($ENV{DBI_DSN} . "x", $ENV{DBI_USER}, 
$ENV{DBI_PASS}, {RaiseError=>0, PrintError=>0});
                print "Test Ok if Errstr not undef: " . $DBI::errstr . "\n";
                $dbh3->disconnect if (defined($dbh3));
        }

        print "the end\n";
        exit(0);

        sub select_long
        {
                my $dbh = shift;
                my @row;
                my $sth;
                my $rc = undef;

                $dbh->{RaiseError} = 1;
                $sth = $dbh->prepare("SELECT COL_A,COL_C FROM $ODBCTEST::table_name 
WHERE COL_A=4");
                if ($sth) {
                        $sth->execute();
                        eval {
                                while (@row = $sth->fetchrow()) {
                                }
                        };
                        $rc = 1 unless ($@) ;
                }
                $rc;
        }

        __END__

There are some observation I could make:
- As it is, the script fails on a segmentation fault at "my $dbh3 = DBI->connect(..."
- By removing the $dbh2 test, the $dbh3 connection doesn't kill the script there, but 
the script still fails with a segmentation fault when hitting the exit statement.
- If I remove the $dbh3 test, then the script fails with an "Illegal instruction (core 
dumped)" on exit.
- All parts of the select_long are needed for the segmentation fault.
- If I remove both the $dbh2 abd $dbh3 tests, then the script runs and finishes 
without problem.

Reply via email to