Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Sybase DB Library vs Client Library API

by perl@1983 (Sexton)
on May 31, 2012 at 07:53 UTC ( #973453=perlquestion: print w/replies, xml ) Need Help??

perl@1983 has asked for the wisdom of the Perl Monks concerning the following question:

Can someone please help to clarify what is the difference between Sybase DB library API and Sybase Client library API? Thanks in advance.
  • Comment on Sybase DB Library vs Client Library API

Replies are listed 'Best First'.
Re: Sybase DB Library vs Client Library API
by derby (Abbot) on May 31, 2012 at 11:38 UTC

    DB-Library was the original client lib for Sybase. It was written in the mid-80s. CT-Lib (Open Client) was supposed to be its replacement -- one that made the api more consistent; however, CT-Lib was significantly different enough that a lot of installations never migrated to CT-Lib so DB-Lib has been kept around.

    The general consensus is new work should use CT-Lib but I would recommend using which ever you're comfortable with (after being deprecated for 20 years now, I doubt the trigger will ever be pulled on DB-Lib). That being said, if you're looking to use perl and Sybase, I would recommend DBI and DBD::Sybase (which is built on top of CT-Lib) rather than any of the Sybase modules. mpeppler maintains them so if he pipes in, ignore me and listen to him.

Re: Sybase DB Library vs Client Library API
by mpeppler (Vicar) on Jun 07, 2012 at 08:19 UTC
    DB-Library is only minimally maintained - new features go into Client Library.

    So don't use DB-Library for any new project - and in perl, use DBI/DBD::Sybase, not Sybase::CTlib unless you really need some of the more esoteric features that might not be available in DBI.


      Thanks for the reply Michael. I prefer DBI/DBD::Sybase as well. But, don't know the reason as to why. Could you please help to clarify why you advice using DBI over CTlib? Thanks again.


        The reason I prefer the DBI/DBD route is that you use the same interface for *any* database. Here at $work, I work with Oracle, MSSQL, SQLite and occasionally PostgreSQL. When I have to interact with a particular database, I don't have to ask myself questions like:

        • OK, how do I read a result set with *this* database?
        • Can I use placeholders in my query? If so, how do I do that?
        • What data structure get I get my results in?

        Since DBI provides a standardized interface, I can be immediately productive when I switch back to a database I use rarely, without having to reacquaint myself with a module I haven't used in a year.

        Sure, there are some occasional differences between the databases, but DBI / DBD lets me ignore most of them. Occasionally, I'll need a special database-specific feature and have to read DBD::Oracle or some such. But better that than having to read documentation on all the everyday operations for selecting, inserting, updating and deleting.

        That's my 1/50 of a dollar.


        When your only tool is a hammer, all problems look like your thumb.

        Same as roboticus, really - the DBI syntax is a little simpler, and the API is (mostly) standardized, so your scripts can be easily maintained by someone else who doesn't necessarily understand the CTlib API.

        And I'm more likely to fix things in DBD::Sybase these days...


Re: Sybase DB Library vs Client Library API
by Ravi V (Scribe) on Nov 20, 2012 at 14:24 UTC
    have converted some of my perl scripts to use CTlib blk instead of DBlib bcp ... but i am facing problem with memory usage(increased)... Is there any document on CTlib memory usage? ..thanks for help in advance
      There should be no significant memory usage differences.

      Do you have some actual code, with volumes and memory usage statistics?


        thanks for reply Michael
        Its seems to be implementation issue..

        yet i have came across other problem now ...
        for "select getdate()"
        DBlib returns:-
        11/28/2012 3:28:38.446 AM
        CTlib returns:- CTlib does special handling for DATETIME
        11/28/2012 3:28 AM
        it would be great if there is some solution on perl side as this have been used on many procedures and changing all the procedure will be problem.

      thanks Michael for this:-

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://973453]
Approved by NetWallah
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-09-25 12:58 GMT
Find Nodes?
    Voting Booth?

    No recent polls found