免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 6910 | 回复: 23
打印 上一主题 下一主题

DBS::SYBASE安装问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-08 12:05 |只看该作者 |倒序浏览
20可用积分
[root@localvm sybase]# make test
cp dbd-sybase.pod blib/lib/DBD/dbd-sybase.pod
cp Sybase.pm blib/lib/DBD/Sybase.pm
/usr/bin/perl -p -e "s/~DRIVER~/Sybase/g" /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver.xst > Sybase.xsi
/usr/bin/perl /usr/lib/perl5/5.8.5/ExtUtils/xsubpp  -typemap /usr/lib/perl5/5.8.5/ExtUtils/typemap  Sybase.xs > Sybase.xsc && mv Sybase.xsc Sybase.c
gcc -c  -I/usr/include/freetds -I/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m32 -march=i386 -mtune=pentium4   -DVERSION=\"1.09\" -DXS_VERSION=\"1.09\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"   Sybase.c
In file included from Sybase.c:352:
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h: In function `dbixst_bounce_method':
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h:14: error: `my_perl' undeclared (first use in this function)
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h:14: error: (Each undeclared identifier is reported only once
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h:14: error: for each function it appears in.)
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h: In function `dbdxst_bind_params':
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h:54: error: `my_perl' undeclared (first use in this function)
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h: In function `dbdxst_fetchall_arrayref':
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h:75: error: `my_perl' undeclared (first use in this function)
make: *** [Sybase.o] Error 1
[root@localvm sybase]#


求救了啊 大大们  有安装好的大大们么 ?

小弟的操作系统 C4.7  
perl5
freetds也安装过了
但是一直安装不上去 求救~!!!!!!!!!



OK  问题都搞定了 多谢各位大大了 小弟下载了一个RPM包 名为 perl-DBD-Sybase的
直接安装上去之后 俺的程序就OK了 多谢各位大大了


感谢各位perl的XDJM

[ 本帖最后由 ppiqq 于 2009-6-11 14:48 编辑 ]

最佳答案

查看完整内容

终于配置好了自己经过测试,现在终于配置好了,现在拿出来和大家共同参考!有问题可以共同学习和提高。关于在UNIX下使用Perl连接Sybase的配置Step 1:安装FreeTDS模块这是个Sybase的Client端软件,必须安装。可以从www.freetds.org/software.html上下载源文件安装程序FreeTDS-stable.tgz来进行安装。可能需要在系统上增加如下的环境变量: LD_LIBRARY_PATH中增加/usr/4lib安装步骤:安装FreeTDS#gunzip FreeTDS-stable.tgz#tar xvf ...

论坛徽章:
0
2 [报告]
发表于 2009-06-08 12:05 |只看该作者

回复 #20 ppiqq 的帖子

终于配置好了

自己经过测试,现在终于配置好了,现在拿出来和大家共同参考!有问题可以共同学习和提高。

关于在UNIX下使用Perl连接Sybase的配置

Step 1:安装FreeTDS模块
这是个Sybase的Client端软件,必须安装。可以从www.freetds.org/software.html上下载源文件安装程序FreeTDS-stable.tgz来进行安装。
可能需要在系统上增加如下的环境变量: LD_LIBRARY_PATH中增加/usr/4lib
安装步骤:
安装FreeTDS
#gunzip FreeTDS-stable.tgz
#tar xvf FreeTDS-stable.tar
#cd freetds-0.63     目前版本是0.63
#./configure --prefix=/usr/local/freetds
#make
#make install
配置FreeTDS
#cd /usr/local/freetds/etc
修改配置文件freetds.conf,在其中增加需要连接的Sybase服务器相关信息,如下:
[TEST]
        host=192.168.0.1
        port=4100
        tds version = 5.0

Step 2:安装和配置DBI-1.50 、DBD-Sybase-1.07 、sybperl-2.18等Module即可。可以从www.cpan.org上下载。

连接示例:
#!/usr/bin/perl
#
use DBI;
use Sybase:Blib;
Sybase:Blib:BSETLCHARSET("eucgb";
Sybase:Blib:BSETLNATLANG("chinese";

$dbh = Sybase:Blib->new('root', '1234', 'TEST');
$dbh->dbcmd("select * from test.name;";
$dbh->dbsqlexec;
while($dbh->dbresults != NO_MORE_RESULTS) {
   while(@data = $dbh->dbnextrow) {
          print @data,"\n";
   }
}
$dbh->dbclose;
急求助:如何配置perl使用Sybase?!(页 1) - Perl - ChinaUnix.net - powered by Discuz! Archiver (11 June 2009)
http://bbs.chinaunix.net/archiver/?tid-705009.html

论坛徽章:
0
3 [报告]
发表于 2009-06-08 12:41 |只看该作者

回复 #1 ppiqq 的帖子

Unfortunately in DBD::Sybase 1.08 I removed some code that allowed it to
work with older DBI versions.

DBD::Sybase 1.08 requires a fairly recent version of DBI (I haven't check
the exact version). If you upgrade your DBI to the current version you
should have no problems.
http://www.issociate.de/board/po ... ith_CentOS_4.5.html

论坛徽章:
0
4 [报告]
发表于 2009-06-08 14:40 |只看该作者

回复 #2 ziggler 的帖子

回复大大 我的DBD的版本是1.09的
DBI perl-DBI-1.40-9

论坛徽章:
0
5 [报告]
发表于 2009-06-08 14:44 |只看该作者
Driver_xst.h:14 贴出来

论坛徽章:
0
6 [报告]
发表于 2009-06-08 14:48 |只看该作者
我换成1.08的 还是不行 还是有问题 求指点

论坛徽章:
0
7 [报告]
发表于 2009-06-08 14:48 |只看该作者

回复 #4 ziggler 的帖子

[root@localvm DBD-Sybase-1.08]# cat /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBI/Driver_xst.h
/*
#  $Id: Driver_xst.h,v 1.5 2003/08/20 00:15:24 timbo Exp $
#  Copyright (c) 2002  Tim Bunce  Ireland
#
#  You may distribute under the terms of either the GNU General Public
#  License or the Artistic License, as specified in the Perl README file.
*/

static SV *
dbixst_bounce_method(char *methname, int params)
{
    /* XXX this 'magic' undoes the dMARK embedded in the dXSARGS of our caller  */
    /* so that the dXSARGS below can set things up as they were for our caller  */
    void *xxx = PL_markstack_ptr++;
    dXSARGS; /* declares sp, ax, mark, items */
    int i;
    SV *sv;
    int debug = 0;
    if (debug >= 3) {
        PerlIO_printf(DBILOGFP, "    -> %s (trampoline call with %d (%ld) params)\n", methname, params, (long)items);
        xxx = xxx; /* avoid unused var warning */
    }
    EXTEND(SP, params);
    PUSHMARK(SP);
    for (i=0; i < params; ++i) {
        sv = (i >= items) ? &sv_undef : ST(i);
        PUSHs(sv);
    }
    PUTBACK;
    i = perl_call_method(methname, G_SCALAR);
    SPAGAIN;
    sv = (i) ? POPs : &sv_undef;
    PUTBACK;
    if (debug >= 3)
        PerlIO_printf(DBILOGFP, "    <- %s= %s (trampoline call return)\n", methname, neatsvpv(sv,0));
    return sv;
}


static int
dbdxst_bind_params(SV *sth, imp_sth_t *imp_sth, I32 items, I32 ax)
{
    /* Handle binding supplied values to placeholders.          */
    /* items = one greater than the number of params            */
    /* ax = ax from calling sub, maybe adjusted to match items  */
    int i;
    SV *idx;
    if (items-1 != DBIc_NUM_PARAMS(imp_sth)
        && DBIc_NUM_PARAMS(imp_sth) != DBIc_NUM_PARAMS_AT_EXECUTE
    ) {
        char errmsg[99];
        sprintf(errmsg,"called with %d bind variables when %d are needed",
                (int)items-1, DBIc_NUM_PARAMS(imp_sth));
        sv_setpv(DBIc_ERRSTR(imp_sth), errmsg);
        sv_setiv(DBIc_ERR(imp_sth), (IV)-1);
        return 0;
    }
    idx = sv_2mortal(newSViv(0));
    for(i=1; i < items ; ++i) {
        SV* value = ST(i);
        if (SvGMAGICAL(value))
            mg_get(value);      /* trigger magic to FETCH the value     */
        sv_setiv(idx, i);
        if (!dbd_bind_ph(sth, imp_sth, idx, value, 0, Nullsv, FALSE, 0)) {
            return 0;   /* dbd_bind_ph already registered error */
        }
    }
    return 1;
}

#ifndef dbd_fetchall_arrayref
static SV *
dbdxst_fetchall_arrayref(SV *sth, SV *slice, SV *batch_row_count)
{
    D_imp_sth(sth);
    SV *rows_rvav;
    if (SvOK(slice)) {  /* should never get here */
        char errmsg[99];
        sprintf(errmsg,"slice param not supported by XS version of fetchall_arrayref");
        sv_setpv(DBIc_ERRSTR(imp_sth), errmsg);
        sv_setiv(DBIc_ERR(imp_sth), (IV)-1);
        return &sv_undef;
    }
    else {
        IV maxrows = SvOK(batch_row_count) ? SvIV(batch_row_count) : -1;
        AV *fetched_av;
        AV *rows_av = newAV();
        if ( !DBIc_ACTIVE(imp_sth) && maxrows>0 ) {
            /* to simplify application logic we return undef without an error   */
            /* if we've fetched all the rows and called with a batch_row_count  */
            return &sv_undef;
        }
        av_extend(rows_av, (maxrows>0) ? maxrows : 31);
        while ( (maxrows < 0 || maxrows-- > 0)
            && (fetched_av = dbd_st_fetch(sth, imp_sth))
        ) {
            AV *copy_row_av = av_make(AvFILL(fetched_av)+1, AvARRAY(fetched_av));
            av_push(rows_av, newRV_noinc((SV*)copy_row_av));
        }
        rows_rvav = sv_2mortal(newRV_noinc((SV *)rows_av));
    }
    return rows_rvav;
}
#endif

[root@localvm DBD-Sybase-1.08]#

论坛徽章:
0
8 [报告]
发表于 2009-06-08 14:50 |只看该作者

回复 #4 ziggler 的帖子

大大 您还是凑合看一下吧
我贴出来的是代码 但是有表情给转换了

论坛徽章:
0
9 [报告]
发表于 2009-06-08 14:52 |只看该作者

回复 #5 ppiqq 的帖子

So you need to add pTHX/pTHX_ as the first argument in function declarations and aTHX/aTHX_ in the function calls. And eventually these errors will go away. Do not use dTHX, since it reverts things to the way they were before. And as you go eliminate any dTHX calls that you use. For more information please refer to the perlguts manpage, when it talks about: The third, even more efficient way is to ape how it is done within the Perl guts: ...
Re: [apreq2] proper support for ithreads (8 June 2009)
http://mail-archives.apache.org/ ... q-dev/200402.mbox/%

论坛徽章:
0
10 [报告]
发表于 2009-06-08 15:02 |只看该作者

回复 #8 ziggler 的帖子

大大 我头晕 可否详细的解释一下????
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP