Re: Unexpected connects and disconnects at the DB server.

Michael Peppler <[email protected]> Wed, 8 Oct 2008 07:15:54 +0200
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <[email protected]>
--Apple-Mail-40-322618982
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit


On Oct 7, 2008, at 10:28 PM, [email protected] wrote:

>
> Guys,
>
> Solaris
> DBD Sybase 1.05
>
> My co-workers code has a single dbh->connect.
> (he has a log/timestamp showing where he only calling it once.)
>
> The sybase sysaudits show repeated login/select/logouts.
> The perl code is believed to simply run multiple prepare/executes.
>
> The logouts are occurring 6 millisecs after the select statement yet  
> his code does not have any explicit disconnect logic.
>
> Any ideas?
>

Yes :-)

What happens is that DBD::Sybase is opening a second connection "under  
the covers" because the query on the primary connection is still  
considered "active" when another query is initiated.

You can easily see this if you run DBD::Sybase with DBI->trace(5).

In DBD::Sybase 1.08 you can set a database connection attribute that  
prohibits opening secondary connections in this way. In addition newer  
versions of DBD::Sybase are better at clearing results from a query.

Michael
--
Michael Peppler              -                    Peppler Consulting  
SaRL
[email protected]         -                     http://www.peppler.org
Sybase DBA/Developer         -      TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ          -      http://www.peppler.org/FAQ/linux.html




--Apple-Mail-40-322618982
Content-Type: text/html;
	charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><br><div><div>On Oct 7, 2008, =
at 10:28 PM, <a =
href=3D"mailto:[email protected]">CSane@EvergreenInvestments.=
com</a> wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite"><br><font size=3D"2" face=3D"sans-serif">Guys,</font> <br> =
<br><font size=3D"2" face=3D"sans-serif">Solaris</font> <br><font =
size=3D"2" face=3D"sans-serif">DBD Sybase 1.05</font> <br> <br><font =
size=3D"2" face=3D"sans-serif">My co-workers code has a single =
dbh->connect. </font> <br><font size=3D"2" face=3D"sans-serif">(he has a =
log/timestamp showing where he only calling it once.)</font> <br> =
<br><font size=3D"2" face=3D"sans-serif">The sybase sysaudits show =
repeated login/select/logouts.</font> <br><font size=3D"2" =
face=3D"sans-serif">The perl code is believed to simply run multiple =
prepare/executes.</font> <br> <br><font size=3D"2" face=3D"sans-serif">The=
 logouts are occurring 6 millisecs after the select statement yet his =
code does not have any explicit disconnect logic.</font> <br> <br><font =
size=3D"2" face=3D"sans-serif">Any ideas?</font> <br><font size=3D"2" =
face=3D"sans-serif"><br></font></blockquote><div><br></div><div>Yes =
:-)</div><div><br></div><div>What happens is that DBD::Sybase is opening =
a second connection "under the covers" because the query on the primary =
connection is still considered "active" when another query is =
initiated.</div><div><br></div><div>You can easily see this if you run =
DBD::Sybase with DBI->trace(5).</div><div><br></div><div>In DBD::Sybase =
1.08 you can set a database connection attribute that prohibits opening =
secondary connections in this way. In addition newer versions of =
DBD::Sybase are better at clearing results from a =
query.</div><div><br></div><div>Michael</div><div>--</div></div><div =
apple-content-edited=3D"true"> <span class=3D"Apple-style-span" =
style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0; "><div style=3D"word-wrap: =
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; "><div><div>Michael Peppler &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;Peppler Consulting =
SaRL</div><div>[email protected] &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a =
href=3D"http://www.peppler.org">http://www.peppler.org</a></div><div>Sybas=
e DBA/Developer &nbsp; &nbsp; &nbsp; &nbsp; - &nbsp; &nbsp; =
&nbsp;TeamSybase: <a =
href=3D"http://www.teamsybase.com">http://www.teamsybase.com</a></div><div=
>Sybase on Linux FAQ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- &nbsp; &nbsp; =
&nbsp;<a =
href=3D"http://www.peppler.org/FAQ/linux.html">http://www.peppler.org/FAQ/=
linux.html</a></div><div><br></div></div></div></span><br =
class=3D"Apple-interchange-newline"> </div><br></body></html>=

--Apple-Mail-40-322618982--