Skip to Content.
Sympa Menu

freetds - newbie help needed.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Arin Komins" <akomins AT midway.uchicago.edu>
  • To: freetds
  • Subject: newbie help needed.
  • Date: Fri, 21 Jan 2000 19:1:21


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 ./test.pl 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:
myserver.uchicago.edu
query tcp ether myiphere 1433
master tcp ether myiphere 1433

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

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

Thanks,

Arin
(akomins AT uchicago.edu)

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

BEGIN {
$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;
$sth->finish();
$dbh->disconnect();




Archive powered by MHonArc 2.6.24.

Top of Page