Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I connect to a MSSQL database using Perl's DBI module in Windows?

How do I connect to a MSSQL database using Perl's DBI module in Windows?

like image 800
culix Avatar asked Oct 14 '08 21:10

culix


Video Answer


1 Answers

Use DBD::ODBC. If you just create a data source with the Control Panel -> System Management -> ODBC Data Sources -> System Data Source or User Data Source (those are the names as I remember them, but my XP isn't in English, so I can't check), then all you have to do is use the name of that data source in the DBI connect string.

my $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pwd, \%attr);

The difference between User and System data source is that the latter is usable by any user.

See also: HOW TO: Create a System Data Source Name in Windows XP

like image 154
bart Avatar answered Sep 17 '22 19:09

bart