in reply to Re^4: MSSQL/Perl
You've given us so little context so I'll have to assume you already know you want to use an ODBC.
DBI provides a single interface to multiple DBDs (DataBase Drivers). Most DBDs only support one database backend (e.g., DBD::Oracle only talks to Oracle, DBD::Pg only talks to postgres) and are usually built against a database supplied client library.
DBD::ODBC is an interface between DBI and the ODBC API so not just one database as many databases have ODBC Drivers. DBD::ODBC needs to link with an ODBC Driver Manager (unixODBC or the MS ODBC Driver Manager). When you use an ODBC Driver in perl:
- your perl code tells DBI which perl DBD to load - the 'dbi:XXX' in the connect string. If you use 'dbi:ODBC', DBI loads the perl DBD::ODBC driver.
- you pass a connection string through DBI which ends up in DBD::ODBC e.g., 'dbi:ODBC:DSN=mydsn'. DBD::ODBC passes this (DSN=mydsn) to the ODBC Driver manager (unixODBC) which uses 'DSN=mydsn' to work out which ODBC Driver to load.
So, to use DBD::ODBC you need to install a) unixODBC and b) an ODBC driver. The unixODBC packages you need are often called 'unixodbc' and unixodbc-dev. Then you'll need to get hold of the ODBC driver for your database, install that and tell unixODBC about it (usually by settings in an /etc/odbcinst.ini file.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: MSSQL/Perl
by tma2620 (Initiate) on Oct 02, 2013 at 15:25 UTC | |
by mje (Curate) on Oct 02, 2013 at 16:02 UTC | |
by tma2620 (Initiate) on Oct 03, 2013 at 02:01 UTC |