Skip to Content.
Sympa Menu

freetds - Re: newbie help needed.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT umcc.ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: newbie help needed.
  • Date: Sat, 22 Jan 2000 20:07:08 -0500 (EST)



Hi,

First thing, unless you need longvarchar column types, I'd recommend using
4.2 instead of 7.0 as it is likely to be more stable (unless you intend
hacking on it, and then by all means go for it). It is also less bandwidth
intensive (due to 7.0 transmitting strings as unicode)

I wouldn't think that using the fqdn would matter but as a matter of
course the name in the interfaces is a simple hostname or alias rather
than its DNS name. The important thing is that 'myiphere' is a valid
hostname in /etc/hosts or in the DNS search path.

One other definite problem is that TDSVER accepts '42', '50', and '70', so
specifying '7.0' it will go to the configured default (5.0 unless you
changed it) which would cause MS SQL to close the connection after the
login packet is received and most likely give you the 'unknown marker'
error. The code should probably allow for 4.2, 5.0 and 7.0 as well.

Brian


On Fri, 21 Jan 2000, Arin Komins wrote:

> 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