in reply to connection issues to MS SQL Server

Maybe this example will help you, the MYSQL server is on the same machine that I am running perl on.
use strict; use DBI; my $db="test"; my $host="gmontematorlt.sjcorp.focusframe.com"; my $userid="guest"; my $passwd="password"; my $connectionInfo="dbi:mysql:$db;$host"; # make connection to database my $dbh = DBI->connect($connectionInfo,$userid,$passwd); my $sth = $dbh->prepare ("SELECT name, category FROM animals"); $sth->execute (); print "<?xml version=\"1.0\"?>\n"; print "<dataset>\n"; while (my ($name, $category) = $sth->fetchrow_array ()) { print " <row>\n"; print " <name>$name</name>\n"; print " <category>$category</category>\n"; print " </row>\n"; } $dbh->disconnect (); print "</dataset>\n";

Replies are listed 'Best First'.
Re^2: connection issues to MS SQL Server
by lsxo (Novice) on Aug 07, 2009 at 18:26 UTC
    This may be a dumb question but what in my code would by similar to your $host. i.e am I missing crucial information?

      Nothing necessarily because he is using mysql and you are using SQL Server. In an ODBC data source you select the host. i.e., when you create the ODBC data source via the data source administrator you select your ms sql server at that time. If you use DSN-less connections you'd use the attribute server=xxxx.