>It looks like you are trying to execute a new statement handle while
>fetching data from another statement handle associated with the same
>database handle, on an SQL Server database via ODBC. According to the
>book "Programming the Perl DBI" the ODBC drivers will not let you do
>this.

>> how can I workaround this?

>Creating another database handle might do the trick. If not, you will
>have to delay your inserts until the fetch loop has finished.

Another way is to use one from the "fetchall" line of calls, and get all
your data at once. Close that statement, then process through the data you
got (doing inserts one at a time then if you wish). Just make sure you
delete your variable if the returned data is large and/or you're concerned
about memory usage.

-Wayne Simmons


--
Software Engineer
InterSystems USA, Inc.
303-858-1000

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian
Raven
Sent: Tuesday, November 20, 2007 8:10 AM
To: [email protected]
Subject: RE: second DBI handle?

Oeschey, Lars (I/EK-142, extern) <> wrote:
> Hi,
> 
> I'm trying to do a database fetch on one table, and an insert on
> another table on the same DB. This looks like this: 
> 
> $mssth=$msdbh->prepare("SELECT * FROM SyncroTess_in"); if
>       ($mssth->execute) { while (my @getdata=$mssth->fetchrow_array) {
>       .....
>       ......
>       $msdbh->do("INSERT INTO SyncroTess_out Pakete, Ladestelle, AKNr,
> time VALUES   ('$einzelpaket','$ladestelle','$aknr','$now'");
>       ....
>       ....
> 
> and I get this error:
> 
> Tue Nov 20 14:55:51 2007 DBD::ODBC::db do failed: [Microsoft][ODBC
> SQL Server Driver]Die Verbindung ist mit Ergebnissen von einem
> anderen hstmt belegt (SQL-HY000)(DBD: Execute immediate failed
> err=-1) at soappush.pl line 35.   
> 
> (i.e. handle is in use)

It looks like you are trying to execute a new statement handle while
fetching data from another statement handle associated with the same
database handle, on an SQL Server database via ODBC. According to the
book "Programming the Perl DBI" the ODBC drivers will not let you do
this.

> 
> how can I workaround this?

Creating another database handle might do the trick. If not, you will
have to delay your inserts until the fetch loop has finished.

HTH

-- 
Brian Raven 



_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to