connect perl with mssql

Posted by Bharanikumar on Stack Overflow See other posts from Stack Overflow or by Bharanikumar
Published on 2011-02-05T07:07:50Z Indexed on 2011/02/05 7:26 UTC
Read the original article Hit count: 221

Filed under:
|

i have user id, password,databasename, datasource details, i want to connect perl with mssql server,

i just used following snippet, but getting error,

#!/usr/bin/perl -w
use strict;

use DBI;

my $data_source = q/dbi:ODBC:192.168.3.137/;
my $user = q/bharani/;
my $password = q/123456/;

# Connect to the data source and get a handle for that connection.
my $dbh = DBI->connect($data_source, $user, $password)
    or die "Can't connect to $data_source: $DBI::errstr";

My Error

DBI connect('192.168.3.137','bharani',...) failed: [Microsoft][ODBC Driver Manag er] Data source name not found and no default driver specified (SQL-IM002) at my sqlconnect.pl line 14 Can't connect to dbi:ODBC:192.168.3.137: [Microsoft][ODBC Driver Manager] Data s ource name not found and no default driver specified (SQL-IM002) at mysqlconnect .pl line 14.

Information: my sql server present in another system, am just trying to connect with above details,

plz tellme, i should crease DSN in my system, or anything i missed in my program

© Stack Overflow or respective owner

Related posts about perl

Related posts about dbi