Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at mbay dot net>
Subject: Re: DBD::Sybase and packet sizes
Date: Mar 16 2004 2:02AM

On Mon, 2004-03-15 at 17:28, Matthew O. Persico wrote:
> We have modified our servers to set the maximum packet size to 4096,
> up from 512. We did this because the main app (commercial software) we
> use works MUCH better with it. This app requires us to set a flag on
> its command line (the size to use, in this case 4096) to pass down to
> Sybase in order to get the better performance. In addition, we wish to
> pass down 4096 to direct DBD::Sybase connections and to some old 'C'
> code using DBlib directly.
> Question 1:
> Now, according to what I've read, if you pass a CTlib app a value for
> packetsize that is too high, the connection will successfully
> negotiate a good value. Since DBD::Sybase uses CTlib under the covers,
> I suspect that I can throw 4096 into the DBI connection string with no
> ill effects, even if the max allowed by the server is less. Ditto for
> a straight CTlib app. True or false?

Not quite - at least not during my quick tests involving OpenClient

Both DBlib and CTlib logins fail if you set the packet size larger than
the max allowed.

The error message is:

4024 10 2 0 luthien  The packet size (4096) specified at login time is
illegal. Legal values are between 512 and 2048.

and is the same for both Client Library and DB-Library apps.

DBD::Sybase, Sybase::CTlib and Sybase::DBlib could be recoded to check
for the 4024 error message at connect time, and retry lower packet sizes
as needed, but at the moment the connect fails if you specify a packet
size that is larger than the max supported.

> Question 2:
> I am betting, however, that if you throw a value higher than the
> server's max setting at DBSETPACKET in DBlib (and Sybase::DBlib),
> DBlib will barf, which could explain why the commercial app barfs if
> you set the flag too high. True or false?

See above.

> Question 3:
> Is there a way in Sybase::DBlib (and raw DBlib for that matter) to
> query the server for the allowed max packet size? I think that
> dbgetpacket gives the size of the current connection, not the max
> allowed.

sp_configure 'max network packet size'

will give you the value you're looking for.

Michael Peppler                              Data Migrations, Inc.             
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions -