|Syntactic Confectionery Delight|
Using DBI to make connection to a databaseby campbell (Beadle)
|on Jul 02, 2015 at 12:22 UTC||Need Help??|
campbell has asked for the wisdom of the Perl Monks concerning the following question:
Greetings O enlightened ones
I have a problem with opening a handle to a database using the DBI Perl module, since, alas, I am a total DBI noob. I would figure it out myself, but I'm in a hurry...
I am using Strawberry Perl version 5.22 and Windows 7.
With the help of Windows' ODBC Data Source Administrator, I have configured a system DSN (named $myDSN), using the windows native ODBC driver (Version 06.01.7601) that connects to a MS-SQL database (named $db) on a remote server (named $srvr) on port $port with username $usr and password $pwd. I have tested the connectivity using the ODBC administrator, and it is fine.
The question is, how do I then get the DBI Perl module to use this information to set up a filehandle so that I can query / retrieve on the database?
I've tried to follow the syntax given in CPAN and (perhaps naively) tried the following:
...which just results in various error messages to the effect that a connection isn't happening.
These error messages are, respectively:
I'm obviously using the completely wrong syntax / approach (maybe I need to set enviroment variables or something?), but I haven't got the time to figure it out myself (which would obviously be more satisfying).
Thanks in advance.