Fellow monks,
I am entirely new to DBI, and wanted to start at the beginning and simply connect to the mysql server, but from the start I have been having trouble. (Note: that my test machine and the mysql server are two separate boxes). I am using activestate perl 5.8 on windows 2000. I am trying to connect to a mysql server (also on windows 2000). Can anybody give me any clues as to what I'm doing wrong. Here's the code:
#! /usr/bin/perl -w use strict; use DBI; my $database="testdb"; my $host="server"; my $port="3306"; my $dsn = "DBI:ODBC:MSSQL:database=$database; host=$host; port=$port"; my $user = 'tester'; my $auth = 'password'; my $dbh = DBI->connect($dsn,$user,$auth,{ RaiseError => 1, AutoCommit +=> 1}); die "Can't connect: " . DBI->errstr() unless $dbh; print "Success: connected\n"; $dbh->disconnect();
Here's the error message I am receiving:
DBI connect('MSSQL:database=testdb; host=server; port=3306','tester',. +..) failed : [Microsoft][ODBC Driver Manager] Data source name not found and no d +efault dri ver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1) at dbitest. +pl line 12
Thanks in advance,
Jonathan

In reply to DBI connection to a remote host by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.