免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: ppiqq
打印 上一主题 下一主题

DBD-Sybase 安装出错 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-20 17:01 |显示全部楼层 |倒序浏览
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 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-05-20 17:02 |显示全部楼层
小弟看到了
If the automatic configuration fails, then you will have to edit the
CONFIG file, and set the EXTRA_LIBS entry according to your OS and
Sybase release, and then run
        perl Makefile.PL --file

The CONFIG file can be used to set certain system variables that
are needed for the build.
        SYBASE is the root directory of your Sybase installation. DBD::Sybase
        will use $SYBASE/lib and $SYBASE/include during the build.

        EXTRA_LIBS lists any extra libraries that are required on your
        system. For example, Solaris 2.x needs -ltli. See your OS specific
        documentation supplement from Sybase to determine what is required.

        DBI_INCLUDE is the directory where DBI installed its include files.
        Makefile.PL will normally deduce this directory from perl's Config
        module, so you only need to set this if Makefile.PL fails.

        LINKTYPE. Uncomment and set to 'static' if you want to build
        DBD::Sybase statically (ie always included in a new perl binary).

论坛徽章:
0
3 [报告]
发表于 2009-05-20 17:16 |显示全部楼层
大大们 我修改了CONFIG文件还是不行

修改如下:
SYBASE=$ENV{SYBASE}||'/opt/sybase'
EXTRA_LIBS=-linsck
DBI_INCLUDE=/usr/lib/perl5/5.8.8

但是仍然报错 求大大们指点一下

论坛徽章:
0
4 [报告]
发表于 2009-05-25 10:44 |显示全部楼层
UP UP~~~~~~~~~~~

论坛徽章:
0
5 [报告]
发表于 2009-05-25 11:37 |显示全部楼层
问题已经解决 原因是没有安装sybase的缘故
不好意思啊 大家 不过貌似还有个问题 我会在另一帖里面说明

论坛徽章:
0
6 [报告]
发表于 2009-06-01 11:12 |显示全部楼层

回复 #9 llvs 的帖子

大大 我从pbone上面下载了包 也都安装上面了 但是貌似我的而环境变量有问题啊 我应该怎么设置了 谢谢了
(发现这俩帖子的开始走到一起了  
[root@nagios DBD-Sybase-1.07]# rpm -qa | grep freetds
freetds-devel-0.64-1.el4.rf
freetds-0.64-1.el4.rf
[root@nagios DBD-Sybase-1.07]# rpm -ql freetds-0.64-1.el4.rf
/etc/freetds.conf
/etc/locales.conf
/etc/pool.conf
/usr/bin/bsqldb
/usr/bin/datacopy
/usr/bin/defncopy
/usr/bin/freebcp
/usr/bin/tdspool
/usr/bin/tsql
/usr/lib/libct.so.4
/usr/lib/libct.so.4.0.0
/usr/lib/libsybdb.so.5
/usr/lib/libsybdb.so.5.0.0
/usr/lib/libtds.so.5
/usr/lib/libtds.so.5.0.0
/usr/lib/libtdsodbc.so.0
/usr/lib/libtdsodbc.so.0.0.0
/usr/lib/libtdssrv.so.2
/usr/lib/libtdssrv.so.2.0.0
/usr/share/doc/freetds-0.64
/usr/share/doc/freetds-0.64/AUTHORS
/usr/share/doc/freetds-0.64/BUGS
/usr/share/doc/freetds-0.64/COPYING
/usr/share/doc/freetds-0.64/COPYING.LIB
/usr/share/doc/freetds-0.64/ChangeLog
/usr/share/doc/freetds-0.64/NEWS
/usr/share/doc/freetds-0.64/README
/usr/share/doc/freetds-0.64/TODO
/usr/share/doc/freetds-0.64/api_status.txt
/usr/share/doc/freetds-0.64/bcp.txt
/usr/share/doc/freetds-0.64/bsqldb.txt
/usr/share/doc/freetds-0.64/cap.txt
/usr/share/doc/freetds-0.64/datacopy.txt
/usr/share/doc/freetds-0.64/defncopy.txt
/usr/share/doc/freetds-0.64/freebcp.txt
/usr/share/doc/freetds-0.64/getting_started.txt
/usr/share/doc/freetds-0.64/policy.txt
/usr/share/doc/freetds-0.64/tds.html
/usr/share/doc/freetds-0.64/tds_ssl.html
/usr/share/doc/freetds-0.64/tsql.txt
/usr/share/doc/freetds-0.64/userguide.sgml
/usr/share/man/man1/bsqldb.1.gz
/usr/share/man/man1/datacopy.1.gz
/usr/share/man/man1/defncopy.1.gz
/usr/share/man/man1/freebcp.1.gz
/usr/share/man/man1/tsql.1.gz
[root@nagios DBD-Sybase-1.07]# export SYBASE="/usr/lib"                 
[root@nagios DBD-Sybase-1.07]# perl Makefile.PL            
Can't find the lib directory under /usr/lib! at Makefile.PL line 113, <IN> line 44.
[root@nagios DBD-Sybase-1.07]#

论坛徽章:
0
7 [报告]
发表于 2009-06-01 12:02 |显示全部楼层
有哪位大大能给出安装DBD::Sybase的详细过程么 多谢了

论坛徽章:
0
8 [报告]
发表于 2009-06-01 16:18 |显示全部楼层
原帖由 MMMIX 于 2009-6-1 12:13 发表

在你用的发行版里面没有打包好的 DBD::Sybase 么?为什么要自己手工安装呢?


报告大大 这个真的没有

论坛徽章:
0
9 [报告]
发表于 2009-06-01 16:31 |显示全部楼层
#!/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 ~]#

论坛徽章:
0
10 [报告]
发表于 2009-06-11 15:50 |显示全部楼层

回复 #15 MMMIX 的帖子

汗~~~~ 今天才看到 我就是这么解决的 嘎嘎
安装了per-DBD-SYBASE之后就OK啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP