newbie help needed.

Arin Komins akomins at
Fri Jan 21 19:01:21 EST 2000

Hi there,

I'm a complete newbie at this, so please forgive me.

I'm trying to connect to a ms sql server 7 database, from unix,
using perl.

I installed freetds (0.50), DBI and DBD::Sybase for perl.

Wrote a quick script to see if I could get any data out, but
its not able to connect.

connect: Connection refused
DBI->connect failed:  at ./ line 18

Now it doesn't look like I'm hitting the sql server at all (I see no
error messages in the sql server 7 event log, for instance.)

my interfaces file looks like:
        query tcp ether myiphere 1433
        master tcp ether myiphere 1433

(interestingly enough, if I change my interfaces file to be just myserver
(sans the I get 
	Unknown marker: 0!!
as my error.

Does anyone know what I'm doing wrong, or have any suggestions? 


(akomins at

My perl code looks like:
use DBI;
use DBD::Sybase;

  $ENV{SYBASE} = '/opt/freetds';
  $ENV{TDSVER} = '7.0';
  $ENV{DSQUERY} = 'myserver';

$user = "sa";
$passwd = "mypass";

$dbh = DBI->connect("dbi:Sybase:database=mydb", $user, $passwd, {PrintError 
=> 1, RaiseError => 1}) || die "connecting: $dbh->errstr";

$sth = $dbh->prepare('
select name_last, name_first from tab_ogsa_master where OGSAID=118 order by 
name_last, name_first
$sth->execute || die "cannot execute";
do {
  while ($d = $sth->fetch) {
    #something here
    print "@$d\n";
} while ($sth->{syb_more_results});
$dbh->commit || die $dbh->errstr;

More information about the FreeTDS mailing list