On Tue, 27 Aug 2002 11:43:48 -0400 Joel Gwynn <[EMAIL PROTECTED]> wrote:
> Hello all. I have some questions about using the ADO driver with M$ SQL
> Server.
>
> 1. Does this driver support transactions? When I try to connect like
> so:
>
> my $dbh = DBI->connect("dbi:ADO:$DSN",'','',{RaiseError => 1, AutoCommit
> => 0}) or die "$DBI::errstr\n";
>
> I get the message: "Can't disable AutoCommit at c:/Perl/site/lib/DBI.pm
> .... "
>
> But it works fine with AutoCommit => 1.
It looks like your combination of ADO and MS SQL Server does not support
transactions. Try upgrading ADO, DBD::ADO, and the SQL Server ODBC driver
(if you are using an ODBC DSN). You might also want to connect directly to
SQL Server use ODBC directly rather than using ADO.
According to
http://search.cpan.org/author/TLOWERY/DBD-ADO-2.5/lib/DBD/ADO.pm the
current version of ADO should be at least 2.1.
> 2. Why would I have trouble with binding?
>
> If I prepare my query like this:
>
> $query = "select product from orders where id=?";
> my $cp = $tdbh->prepare($query);
> $cp->execute($id) || print $tdbh->errstr;
> my ($product) = $cp->fetchrow_array;
>
> I get the error: "No value given for one or more required parameters."
This looks reasonable, but you are not checking for errors from prepare().
> But if I prepare it like this:
>
> $query = "select product from orders where id=$id";
> my $cp = $tdbh->prepare($query);
> $cp->execute() || print $tdbh->errstr;
> my ($product) = $cp->fetchrow_array;
>
> I get a value.
>
> I've also tried using the bind_param method, to no avail. Could this be
> a problem with the ADO driver? Has anyone else had this problem?
Could be. trace() will let you see what the drivers think they are doing.
Read all about it in the fine manual (perldoc DBI and perldoc DBD::ADO).
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.