RE: DBD::ODBC error
- From: "Koivu, Lisa" <Lisa.Koivu@xxxxxxxxxxxxxxx>
- To: <oracle-l@xxxxxxxxxxxxx>
- Date: Fri, 27 Feb 2004 15:39:51 -0500
I'm connecting to a sql server database through odbc, using DBD::ODBC.
Actually I just fixed it, don't ask me why this works and the other one
didn't. I took some code directly out of the Perl DBI book and it
worked, imagine that. After banging my head against the wall for 2
hours, another 5 minutes and I stumble on the fix. Jeez.
Thanks
#!/usr/bin/perl -w
use strict;
use DBI;
my $arrayref;
my $dbh_ss = DBI->connect("dbi:ODBC:briorep","brioadmin","Password01")
or die "Cant connect to db: $DBI::errstr\n";
my $stmt_getid = qq{SELECT unique_id FROM briojobs WHERE
completion_status <> 'Successful' and completion_status IS NOT NULL AND
file_name LIKE 'SM%'};
my $sth_getid = $dbh_ss->prepare($stmt_getid);
my $stmt_upd = qq{UPDATE briojobs SET next_date = NULL, last_date =
NULL, completion_status = NULL WHERE unique_id = ? };
my $sth_upd = $dbh_ss->prepare($stmt_upd);
$sth_getid->execute();
$arrayref = $sth_getid->fetchall_arrayref();
foreach my $unique_id (@$arrayref) {
$sth_upd->execute(@$unique_id);
};
-----Original Message-----
From: Peter Barnett [mailto:regdba@xxxxxxxxx]
Sent: Friday, February 27, 2004 3:32 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: Re: DBD::ODBC error
What is this:
[Microsoft ODBC SQL Server Driver]
--- "Koivu, Lisa" <Lisa.Koivu@xxxxxxxxxxxxxxx> wrote:
> Hi everyone,
>
> The script below throws the following error:
> "DBD::ODBC:st execute
> failed: [Microsoft ODBC SQL Server Driver]Connection
> is busy with
> results for another hstmt(SQL-HY000)(DBD:
> st_execute/SQLExecute err=-1)
> at tests.pl line 20."
>
> What on earth? I am trying to parameterize the
> update statement and
> it's failing.
>
> For the record, I tried concatenating the
> unique_id's into one string
> and using an IN() statement, but I received the
> following errors (with
> and without using SQL_VARCHAR and explicitly binding
> the parameters):
>
> DBD::ODBC::st execute failed: [Microsoft}{ODBC SQL
> Server Driver]Invalid
> character value for cast specification
> (SQL-22018)...
>
> My in-list looked like this: 217, 219, 221, 222
>
> The statements both work in query analyzer.
>
> Has anyone ever seen this before? Any comments or
> suggestions are
> appreciated.
>
> Thank you
> Lisa Koivu
>
>
>
> #!/usr/bin/perl -w
> use strict;
> use DBI;
>
> my $dbh_ss =
>
DBI->connect("dbi:ODBC:briorep","brioadmin","Password01")
> or die "Cant connect to db:
> $DBI::errstr\n";
>
> my $stmt_getid = qq{SELECT unique_id FROM briojobs
> WHERE
> completion_status <> 'Successful' and
> completion_status IS NOT NULL AND
> file_name LIKE 'D%'};
> my $sth_getid = $dbh_ss->prepare($stmt_getid);
>
> my $stmt_upd = qq{UPDATE briojobs SET next_date =
> NULL, last_date =
> NULL, completion_status = NULL WHERE unique_id = ?
> };
> my $sth_upd = $dbh_ss->prepare($stmt_upd);
>
> $sth_getid->execute();
>
> while (my @array = $sth_getid->fetchrow_array) {
>
> #Fails here, every time
> $sth_upd->execute($array[0]);
> sleep 1;
>
> };
>
> Lisa Koivu
> desk: 407-248-4277
> cell: 954-683-4459
>
>
>
> "The sender believes that this E-Mail and any
> attachments were free of any virus, worm, Trojan
> horse, and/or malicious code when sent. This message
> and its attachments could have been infected during
> transmission. By reading the message and opening
> any attachments, the recipient accepts full
> responsibility for taking proactive and remedial
> action about viruses and other defects. The sender's
> business entity is not liable for any loss or damage
> arising in any way from this message or its
> attachments."
>
>
----------------------------------------------------------------
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
>
----------------------------------------------------------------
> To unsubscribe send email to:
> oracle-l-request@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at
> http://www.freelists.org/archives/oracle-l/
> FAQ is at
> http://www.freelists.org/help/fom-serve/cache/1.html
>
-----------------------------------------------------------------
=====
Pete Barnett
Lead Database Administrator
The Regence Group
pnbarne@xxxxxxxxxxx
__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
"The sender believes that this E-Mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during transmission. By reading the
message and opening any attachments, the recipient accepts full responsibility
for taking proactive and remedial action about viruses and other defects. The
sender's business entity is not liable for any loss or damage arising in any
way from this message or its attachments."
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Other related posts: