views:

210

answers:

1

Using a perl script (Perl 5.8.6), I'm connecting to Sybase dataserver.

Looking for the following:

  1. How many connections are currently opened by the script.

  2. Generic (non-dataserver specific) Error handling modules/mechanism

When executing a stored proc, it returned the following error message.

DBD::Sybase::st execute failed: Server message number=27000 severity=16 state=1 line=4 server=SYBDEV_HYD procedure=j_err text=But this one does [for Statement "EXEC sandbox..j_err"] at /usr/local/lib/perl5/site_perl/5.8.6/DBIx/ContextualFetch.pm line 51.

Since the user of this script is a non-techie, trying to report only the message "But this one does" (that appears after the text=). Though I can parse this, trying to see if there is any generic module, since other dataserver (like MySQL, SQL Server etc.) can have their own way of reporting the error msg.

+3  A: 

I'm not quite sure what you're asking, but you'll find a lot of information by reading through the documentation for DBD::Sybase and DBI. You probably have to keep track of the number of connections yourself (see the example for DBI->connect).

For error-handling, you should probably just compose a reasonable diagnostic message yourself along with a line number - you can do this easily with warn() or carp().

Please also feel free to edit your question with more specifics about what you are trying to do; some sample code would be helpful.

Ether