DBD::ODBC 1.06 Problem with prepare when using newer MS SQL ODBC driver

From: Martin Busik (martinb_at_mediascape.de)
Date: 11/12/03


Date: 12 Nov 2003 08:52:51 -0800

Hi there,
given the following example:
--------------- SNIP SNIP ---------
use DBI;

$connection = DBI->connect("DBI:ODBC:mydb", q(user), q(passw));
if(($DBI::err != 0) || !$connection) {
  die "not connected!\n";
}

$csr = $connection->prepare("select 1 from table_that_does_not_exist");
if(($DBI::err != 0) || !$csr) {
  die "got no cursor!\n$DBI::err\n$DBI::errstr\n";
    
}

if(!defined($csr->{NUM_OF_PARAMS}) || !$csr->{NUM_OF_PARAMS}) {
  print "executing!\n";
  $csr->execute();
  print "executed!\n";
} else {
  print "not executed!\n";
}

$connection->disconnect();
------------- SNIP SNIP ------------

When connecting to a ms sql database on a win32 plattform
using the odbc driver version 3.70.08.21, prepare fails as expected.

when connecting to the same database on a win32 plattform
using the odbc driver version 2000.81.9031.14, prepare does not fail.
Failure occurs at the subsequent $csr->{NUM_OF_PARAMS} expression.

Does anybody have the same problem? Is there any special initialization/setup
of the 2000.xxx driver necessary?

Regards,
Martin



Relevant Pages

  • Re: syntax error at or near "{" at character 86(#-1)
    ... Connecting using the PostgeSQL ODBC driver. ... tracking turned on and it shows a different statement SQL statement created ... in Access than is being actually sent to SQL. ...
    (microsoft.public.access.queries)
  • Re: ASP.NET IIS6 Impersonation - Explanation needed for this situation
    ... ASP.NET application connecting to a SQL database. ... I found that Impersonation can be turned on or off, it doesn't matter. ...
    (microsoft.public.dotnet.security)
  • Error connectiong to database
    ... I am connecting to a progress database. ... I tested the connection from the odbc driver and it works fine. ... Additional information: System error. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: User Password
    ... a datasource (even if you're connecting using the ODBC driver). ... Perhaps if you were more specific about how your are connecting to the db ... >> necessary info that sql server needs to validate the user. ... >> Doug. ...
    (microsoft.public.vb.general.discussion)
  • Re: Error connectiong to database
    ... > It's hard to tell from just that, but I'd wrap open in a try/catch block and ... > trap OleDbException.ToStringand see if I got any more information. ... >> I am connecting to a progress database. ... > tested the connection from the odbc driver and it works fine. ...
    (microsoft.public.dotnet.framework.adonet)