Skip to Content.
Sympa Menu

freetds - [freetds] integers, perl and unixodbc

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "nat" <nat AT nuqe.net>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] integers, perl and unixodbc
  • Date: Wed, 21 Jan 2004 14:33:26 -0000

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.

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 |
+---------+---------+

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";
};


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


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



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



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






Archive powered by MHonArc 2.6.24.

Top of Page