Why does make test in DBD::ODBC to SQL Server fail?

This applies to DBD::ODBC 1.14 (and earlier versions). It may apply to versions of DBD::ODBC later than 1.14 if our patch for the fix is not implemented by the maintainer (refer to the DBD::ODBC changes file).

In SQL Server 2005 and later, Microsoft changed the way:

dbcc TRACESTATUS(-1)

works. This affects tests 28, 31, 32, and 33 in the 20SqlServer module.

The errors are:

t/20SqlServer....ok 4/37
#   Failed test 'dbcc messages being returned'
t/20SqlServer....NOK 28#   in t/20SqlServer.t at line 443.
#     '0'
#         >
#     '0'
t/20SqlServer....ok 29/37Describe failed during DBI::st=HASH(0x9d65010)->FETCH(o
dbc_more_results,0) at t/20SqlServer.t line 453.

#   Failed test 'ensure 2 error messages from two print statements'
#   in t/20SqlServer.t at line 459.
#          got: '3'
#     expected: '2'
t/20SqlServer....NOK 31
#   Failed test 'validate error messages being retrieved'
#   in t/20SqlServer.t at line 460.
#          got: 'Connection is busy with results for another hstmt'
#     expected: 'END'
t/20SqlServer....NOK 32
#   Failed test 'Multiple concurrent statements should fail'
#   in t/20SqlServer.t at line 471.
DBI::db=HASH(0x9d1f1cc)->disconnect invalidates 1 active statement handle (eithe
r destroy statement handles or call finish on them before disconnecting) at t/20
SqlServer.t line 473.
t/20SqlServer....ok 36/37# Looks like you planned 37 tests but only ran 36.
# Looks like you failed 4 tests of 36 run.
t/20SqlServer....dubious
        Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 28, 31-33, 37
        Failed 5/37 tests, 86.49% okay

You can ignore these failures as they are an error in the test rather than a bug in DBD::ODBC itself. Alternatively, you can follow the instructions below to correct the problem.

Open t/20SqlServer in a text editor. Search for:

$sth = $dbh->prepare("dbcc TRACESTATUS(-1)");

and change it to:

$sth = $dbh->prepare("dbcc TRACESTATUS(0)");