Skip to Content.
Sympa Menu

freetds - RE: [freetds] integers, perl and unixodbc

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] integers, perl and unixodbc
  • Date: Wed, 21 Jan 2004 17:40:35 +0100


>
> Hi all,
>
> I've got freetds installed and configured, I used apt to install it on
> Debian. I've managed to connect ok using DBI in Perl via
> unixodbc, and I
> started writing a script and then noticed that columns in the
> database that
> are int and over 10 were not being returned.
>

What version did you find? The last one is 0.62.1.

> I tried running the query manually in isql and the data was
> returned ok,
> just not in perl, does anyone know how I can fix this?
>
> I've included my config files below and the source and output
> from my test
> perl script.
>
> Any help will be much appreciated, sorry if I've missed
> something obvious.
>
> Thanks,
>
> Nat,
>
>
> ijob@dev1:~$ isql intweb
> SQL> select plotid, border from plots;
> query = select plotid, border from plots;
> +---------+---------+
> | | |
> +---------+---------+
> | 1 | 10 |
> | 2 | 5 |
> | 3 | 6 |
> | 4 | 7 |
> | 5 | 8 |
> | 6 | 9 |
> | 7 | 0 |
> | 8 | 10 |
> | 9 | 15 |
> | 10 | 11 |
> | 11 | 12 |
> | 12 | 13 |
> | 13 | 5 |
> | 14 | 5 |
> | 15 | 5 |
> | 16 | 5 |
> | 17 | 0 |
> +---------+---------+
>

Strange, there is no row names...

> ijob@dev1:~$ cat report.pl
> #!/usr/bin/perl -w
> use DBI;
> my $dbh = DBI->connect('DBI:ODBC:intweb','ijob','ijob');
> my $sth = $dbh->prepare("select * from plots;");
> $sth->execute();
> while ($row = $sth->fetchrow_hashref('NAME_lc')) {
> print "$row->{plotid} $row->{border}\n";
> };
>

...however perl seem to find names...

>
> ijob@dev1:~$ ./report.pl
> query = select * from plots;
> 1
> 2 5
> 3 6
> 4 7
> 5 8
> 6 9
> 7 0
> 8
> 9
> 10
> 11
> 12
> 13 5
> 14 5
> 15 5
> 16 5
> 17 0
>

Quite strange. Perhaps you are using an old version that return invalid
information for string lengths.

>
> ijob@dev1:~$ cat .odbc.ini
> [Default]
> Driver = /usr/lib/odbc/libtdsodbc.so
> FileUsage = 1
>
> [TDS]
> Driver = /usr/lib/odbc/libtdsodbc.so
> FileUsage = 1
>
> [intweb]
> Database = intweb
> Server = 192.168.0.2
> TDS_Version = 7.0
> Port = 1433
> Driver = TDS
> Description = Interrogator
> Servername = COMPAQ
> UID = ijob
> PWD = ijob
>

Driver should not go in odbcinst.ini ? However it connect so shouldn't
be the problem...

>
>
> ijob@dev1:~$ cat /etc/freetds/freetds.conf
> [global]
> tds version = 4.2
> initial block size = 512
> swap broken dates = no
> swap broken money = no
> try server login = yes
> try domain login = no
> cross domain login = no
>
> [COMPAQ]
> host = 192.168.0.2
> port = 1433
> tds version = 7.0
>

ODBC should ignore this configuration cause you specified already server
in odbc.ini.

>
>
> ijob@dev1:/usr/share/freetds0$ cat interfaces
> COMPAQ
> query tcp 5.0 192.168.0.2 1433
>

interfaces file is an old configuration, it's better to remove it.

It seems you are using 0.61 version (I don't think server configuration
worked on 0.60)

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page