On Fri, 2002-04-19 at 23:07, Michael Eales wrote:
> Hi,
> 
>       I have a perl script that talks to a Sybase database through DBI to
> DBD::Sybase.
> The insert or update queries seems to open up an new TCP connection for each
> update or insert that the script has to perform.
> Once the statement has been executed it leaves the port in TIME_WAIT and
> will then open up a new connection  to execute the next non-select query.
> I have tried both the $Sth->do() and the prepare/execute method and they
> both do the same.
> I only connect to the database once with the DBI->connect() and don't close
> the connection until the script has finished.

I bet that you are doing inserts while an active query is being run.

Please remember that DBD::Sybase can only emulate multiple simultaneous
queries on one $dbh by opening additional connections "under the hood".
In general if you need to execute queries based on another query (i.e.
do inserts while in a fetch loop) it is better to open a second
connection for the inserts (however, be aware that if the
inserts/updates affect the same table as the query you run the risk of
getting deadlocks).

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
[EMAIL PROTECTED]           *or*          [EMAIL PROTECTED]
http://www.mbay.net/~mpeppler
International Sybase User Group: http://www.isug.com

Reply via email to