Dear Monks,
The following code produces the following report. Any explanations?
#! perl -w scipt
use strict;
use DBI;
use DBD::ODBC;
my ( $data_source, $database, $user_id, $password ) = qw( matt First_t
+rial matt gold );
my $conn_string = "driver={SQL Server};Server=$data_source;Database=$d
+atabase;UID=$user_id;PWD=$password";
my $dbh = DBI->connect( "DBI:ODBC:$conn_string" ) or die $DBI::errstr;
my $sql = "SELECT * FROM Doncaster_1975_onwards LIMIT 100";
my $sth = $dbh->prepare( $sql );
$sth->execute;
my $out = "out_connection.txt";
open (OUT, "$out");
while ( my $result = $sth->fetchrow_hashref ) {
# Your fields can be accessed through the $result hashref, for exa
+mple:
print OUT "$result\n";
}
$dbh->disconnect;
C:\Documents and Settings\MattR\2003\Perl\November\5_12_04>perl Data_A
+.pl
DBI connect('driver={SQL Server};Server=matt;Database=First_trial;UID=
+matt
;PWD=gold','',...) failed: [Microsoft][ODBC SQL Server Driver][Named P
+ipes]S
pecified SQL server not found. (SQL-08001)
[Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionOpen (Create
+File()). (
SQL-01000)(DBD: db_login/SQLConnect err=-1) at Data_A.pl line 15
[Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL server n
+ot found.
(SQL-08001)
[Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionOpen (Create
+File()). (
SQL-01000)(DBD: db_login/SQLConnect err=-1) at Data_A.pl line 15.