DaWolf has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, fellow monks.

I'm working on an Intranet application that runs on a NT server and uses Win32::ODBC to access an Oracle database.

Well, I was finally - better later than never - taking a look at DBI and since I've heard marvelous things about it, I decided to give it a try.

Since I didn't had the chance to test if there is a performance improvement between them, I was wondering if a more experienced monk had noticed any.

So, putting in a well written question: Is there any performance difference between DBI and Win32::ODBC?

Thanks for sharing your exeprience,

Er Galvão Abbott
a.k.a. Lobo, DaWolf
Webdeveloper

Replies are listed 'Best First'.
Re: DBI vs. Win32::ODBC
by fokat (Deacon) on Oct 23, 2001 at 05:05 UTC
    According to this book, which IMHO is an excellent guide for programming Perl using databases, Win32::ODBC tries to be an interface for ODBC, while DBI tries to be an abstraction layer on top of any database.

    That said, I've never encountered real performance gains in one over the other. DBI is excellent when you need the ability to connect your software to a different database... With DBI this is often as simple as changing the connection string (and perhaps some simple changes to the SQL statements).

    In my experience, using DBI has been simpler than Win32::ODBC, and the applications can be developed and run in multiple platforms. This of course would be irrelevant if your target platform is always going to be WinNT.

      To re-iterate the point: DBI lets you use a multitude of Database interfaces (ODBC, ADO, or an interface written for a specific database such as Oracle or Sybase or even CSV files).

      Additional Note I forgot to put in my original reaply: The reason I point this out is that sometimes ODBC works better, sometimes ADO works better, and sometimes the native driver works best. (I've had many problems trying to call Oracle functions using ODBC, although they work fine using the Oracle driver or ssometimes ADO.)

      Also: Win32::ODBC hasn't been updated in a few years (the version with ActivePerl is from 1997).

Re: DBI vs. Win32::ODBC
by hopes (Friar) on Oct 23, 2001 at 03:54 UTC
    I've worked with DBI and ODBC
    DBI is not an standard module, and you can work with ODBC without installing any module.
    ODBC is faster making a connection (with SQL Server) than DBI.
    In DBI is easy to get the ID of the record that you insert with 'insert into...', it's only necessary one sentence; in ODBC I have to execute two sentences

    Try a supersearch for more information
    Hope this helps
    Hopes

      Of course Win32::ODBC is only standard with Activestate. DBI, while not core either, does run on multiple platforms and doesn't lock you in to running on Wintendo. If you write to DBI you can fairly easily (for some values of easily) move to a different platform without rewriting.