安装Sybase module for Python

1、下载Sybase module for Pythonpython

$ wget http://nchc.dl.sourceforge.net/project/python-sybase/python-sybase/python-sybase-0.40pre2/python-sybase-0.40pre2.tar.gzlinux

2、解压sql

tar xzvf python-sybase-0.40pre2.tar.gz测试

3、修改setup.pyfetch

    把 sybase = '/opt/sybase' 改成sybase = '/opt/sybase/OCS-16_0'ui

4、编译安装.net

python setup.py buildcode

sudo python setup.py installorm

5、测试rem

$ python

Python 2.7.6 (default, Jun 22 2015, 17:58:13) 

[GCC 4.8.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import Sybase

>>> Sybase.connect('MYMOTIFVOSTRO145480', 'sa', 'wxwpxh')

若是没有错误信息、说明安装成功了

sybtest.py

import sys, string, Sybase

db = Sybase.connect('MYMOTIFVOSTRO145480', 'sa', 'wxwpxh')
c = db.cursor()
if len(sys.argv) > 1:
    c.execute('select c.text from syscomments c, sysobjects o'
              ' where o.name = @name and o.type = "P" and c.id = o.id'
              ' order by c.colid', {'@name': sys.argv[1]})
    print string.join([row[0] for row in c.fetchall()], '')
else:
    c.execute('select name from sysobjects where type = "P" order by name')
    print string.join([row[0] for row in c.fetchall()], '\n')

$ python sybtest.py

sp_addconf

sp_autoformat

sp_aux_checkroleperm

sp_aux_getsize

sp_check_remote_tempdb

sp_configure

sp_dboption

sp_dboption_flmode

sp_dropdevice

sp_getmessage

sp_instmsg

sp_loaddbupgrade

sp_namecrack

sp_probe_xact

sp_procxmode

sp_prtsybsysmsgs

sp_remotesql

sp_validlang

相关文章
相关标签/搜索