Kindly help me to fix ,thisDBI 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 (Conn +ect()). (S QL-01000) at ETLTEST.pl line 10
use DBI; # DBD::ODBC my $dsn = 'DBI:ODBC:Driver={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 connect +ion not made: $DBI::errstr" ; print "testing"; my $sql = "SELECT enqno, enqdate, cuscode FROM tbl_CusEnqry "; my $sth = $dbh->prepare( $sql ); #Execute the statement $sth->execute(); 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 $sth->finish(); $dbh->disconnect();
In reply to Perl DBI -- SQL Server Error by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |