Monday, August 25, 2014

Connect TO MSSQL Server 2012 using PERL Script

# Connect to remote machine using IP Address

my $host     = 'xxx.xxx.xx.xxx';
my $database = 'database_name';
my $user     = 'username';
my $pass    = 'password';

# Connect to remote machine using Server Name

my $host     = 'ServerName';
my $database = 'database_name';
my $user     = 'username';
my $pass    = 'password';


my $dsn = "dbi:ODBC:Driver={SQL Server};Server=$host;Database=$database";
my $dbh = DBI->connect($dsn, $user, $auth, { RaiseError => 1 });


No comments:

Post a Comment