Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

(pmas) DBI or Win32::ODBC: which way to go?

by pmas (Hermit)
on Jul 26, 2001 at 19:41 UTC ( [id://100018]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Win32::ODBC - Update SQL statement
in thread Win32::ODBC - Update SQL statement

Your goal (database independence) is right, but I am not so sure about your way to achieve it.
DBI.pm is the way to database independent data access, and was designed along ODBC guidelines - early adopter. DBI allows you to move your code from Win PC with some ODBC-compliant database to i.e. Linux and database which may or may not be ODBC-compliant, just DBI-compliant driver will be enough.

You are using two layers of interfaces: (1) from your program to local database access client, and (2) from PC to database server (which might be on the same PC, LAN, or internet).
Your approach is to use Win32::ODBC for task (1), and ODBC for task (2). But, if you decide to move your code to different machine/OS, you may or may not have available Win32::ODBC there, because Win32 in module name suggests it is windows-specific module. DBI most likely will be there, so you can use DBI calls exactly as on PC.
As an added advantage, sometimes native DBD drivers (DBD::Oracle) might implement some DBI calls more efficently than standard ODBC, or you may add some nifty time-saving feature just for ORACLE, using ORACLE's SQL extension, and implementing it for other databases in less eficient, but more standard SQL.
Also, much more programmers know DBI calls, so you may have more help (dbi-user email list etc) and excellent "Programming the Perl DBI" book written by author of DBI, Tim Bunce, with Alligator Descartes (the "Cheetah book"). It describes DBI from basics to other esoteric stuff like reading SQL cursors (sets of records) to arrays of hashes, which you can use for HTML::Template etc.

I might be wrong here with performance issue (you did not mentioned how important it is for you), so you may want to impement both, and benchmark. Or maybe somebody here can advise on performance issue - or ask in dbi-users mail list.

I myself prefer DBI and am happy with it.
Just my $0.02.

pmas
To make errors is human. But to make million errors per second, you need a computer.

  • Comment on (pmas) DBI or Win32::ODBC: which way to go?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://100018]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-25 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found