- 论坛徽章:
- 0
|
5可用积分
此贴已改
#!/usr/bin/perl
use DBI;
$dsn = 'DBI:Sybase:server=sql1';
my $dbh = DBI->connect($dsn, "test", 'test');
die "unable to connect to server $DBI::errstr" unless $dbh;
$dbh->do("use sqltest";
$query = "SELECT * FROM testtable";
$sth = $dbh->prepare ($query) or die "prepare failed\n";
$sth->execute( ) or die "unable to execute query $query error $DBI::errstr";
$rows = $sth->rows ;
print "$row rows returned by query\n";
while ( @first = $sth->fetchrow_array ) {
foreach $field (@first) {
print "field: $field\n";
}
}
[root@nagios ~]# ./a
Segmentation fault
[root@nagios ~]#
————————————————————————————————————————————
/etc/freetds.conf文件内容为:
[sql1]
host = fabu
port = 1433
tds version = 4.2
——————————————————————————
[root@nagios ~]# ping fabu
PING fabu (192.168.3.235) 56(84) bytes of data.
64 bytes from fabu (192.168.3.235): icmp_seq=0 ttl=128 time=1.81 ms
--- fabu ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.810/1.810/1.810/0.000 ms, pipe 2
[root@nagios ~]#
为什么这个程序不行呢 我按照文档说的 是运行tsql没有问题啊
[root@nagios ~]# tsql -S fabu -U test
locale is "en_US.UTF-8"
locale charset is "UTF-8"
Password:
1>
2>
多谢各位老大了 我想之前的程序有问题应该也是一样吧?
抑或我的DBD::SYBASE
[ 本帖最后由 ppiqq 于 2009-6-1 16:39 编辑 ] |
最佳答案
查看完整内容
你用嘛发行版?搜索过么?BTW,我倒是搜索了一下http://www.google.com/search?hl=en&q=rpm+dbd+sybase&aq=f&oq=&aqi=
|