Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: two connections to the same database with DBD::Sybase

by busunsl (Vicar)
on Dec 10, 2002 at 13:01 UTC ( #218777=note: print w/ replies, xml ) Need Help??


in reply to two connections to the same database with DBD::Sybase

I found the error!

It was on my side :-(

Hrmph!

I played around a bit, tried the same script with different servers and got the same error.
So it wasn't due to messing up connections or statements.
It was because one statement wasn't finished before the next started.

A simple $sth2->finish after the fetchrow_array got rid of the error.


Comment on Re: two connections to the same database with DBD::Sybase
Download Code
Re: Re: two connections to the same database with DBD::Sybase
by tachyon (Chancellor) on Dec 10, 2002 at 14:04 UTC

    Sybase has a known issue along these lines. From what I know it does not finish and can't be made to finish a fetchrow_array until it reads a null result. As I understand it this is a peculiarity of the Sybase library functions. This is mentioned at Re^4: portable mysql auto_increment in relation to Sybase choking with DBIx::Sequence

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Re: two connections to the same database with DBD::Sybase
by mpeppler (Vicar) on Dec 10, 2002 at 16:42 UTC
    I see you found it... I know that the DBI docs specify that $sth->finish is in general not needed, but in the type of code that you used there is no way for DBD::Sybase to realize that there are no results after the single row fetched through the $sth2 handle (well, it could do a look-ahead fetch, but then it would have to store the fetched row somewhere until the script calls fetch() again. Feasible, but messy).

    I should probably improve the documentation a bit to be more explicit about the need to finish executions properly, either by fetching until no more rows are found, or by using finish().

    Michael

      I should probably improve the documentation a bit to be more explicit about the need to finish executions properly, either by fetching until no more rows are found, or by using finish().

      This might help, but not me ;-(

      One thing I always pray when talking about DBI is: Always finish your statements!

      And then I didn't do it myself :-(

      Perhaps there is room for enhancement somewhere else.
      If there had been the connection parameters (server, database) somewhere in the error messages, I would have found the error earlier.

      Michael, this is a feature request ;-)

        I know it's been almost a year, but DBD::Sybase 1.01 (to be released RSN) won't require the finish request in this situation any more.

        Michael

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://218777]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2014-10-21 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (110 votes), past polls