Hello ,

I'm using SQL Server 2008 which is installed locally in my system . were im trying to connect my database with perl module DBI
but while executing the below it throws an error :

DBI connect('Driver={SQL Server};Server=SRINI-PC;Database=ERP','sa',...) failed:
[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or
access denied. (SQL-08001) [state was 08001 now 01000]
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Connect()). (S
QL-01000) at ETLTEST.pl line 10

Kindly help me to fix this

use DBI;
my $dsn = 'DBI:ODBCriver={SQL Server}';
my $host = 'SRINI-PC';
my $database = 'ERP';
my $user = 'sa';
my $auth = 'sri@123';
# Connect via DBD::ODBC by specifying the DSN dynamically.

my $dbh = DBI->connect("$dsn;Server=$host;Database=$database", $user, $auth, { RaiseError => 1, AutoCommit => 1} ) || die "Database connection not made: $DBI::errstr" ;
print "testing";

my $sql = "SELECT enqno, enqdate, cuscode FROM tbl_CusEnqry ";
my $sth = $dbh->prepare( $sql );
#Execute the statement
my( $id, $name, $phone_number );
# Bind the results to the local variables
$sth->bind_columns( undef, \$id, \$name, \$phone_number );
#Retrieve values from the result set
while( $sth->fetch() ) {
print "$id, $name, $phone_number\n";
#Close the connection

Thanks in advance,