Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Access to MS Server by Win

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2023-03-30 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (74 votes). Check out past polls.

    Notices?