| 查看: 170 | 回复: 0 | ||
| 当前主题已经存档。 | ||
[资源]
python连接oracle数据库的动态库-cx_oracle
|
||
|
python连接oracle数据库的动态库-cx_oracle python连接oracle数据库的动态库的下载地址 http://www.python.net/crew/atuining/cx_Oracle/ 这是一段测试小程序: import cx_Oracle connection = cx_Oracle.connect("用户名", "密码", "数据库" ![]() cursor = connection.cursor() cursor.arraysize = 15 cursor.execute("""select fnxh,fcjym,fcjymc from tryxrz""" ![]() for fnxh,fcjym,fcjymc in cursor.fetchall(): print str(fnxh)+" "+str(fcjym)+" "+str(fcjymc) 在python2.5+cx_oracle3.4.1+oracle9.2上测试通过. python调用cx_Oracle开发(-)---cx_Oracle安装 上面是windows的,接下来是linux的,是转的别人的帖子,原帖地址在这里 http://blog.csdn.net/LIUYANG007/archive/2007/03/16/1531167.aspx 开始在ubuntu下用python调用oracle,决定使用cx_Oracle. 安装前要确定oracle安装成功并能正常使用 在cx_Oracle的网站上http://www.python.net/crew/atuining/cx_Oracle/ 有windows和linux 2种安装版本 按照自己的具体配置选择下载版本,我是oracle10,python 2.4 下载Fedora Core 5 RPM (Oracle 10g, Python 2.4), cx_Oracle-4.3-10g-py24-1.i386.rpm 先把rpm转换成deb安装 suod alien cx_Oracle-4.3-10g-py24-1.i386.rpm cx_Oracle-4.3-10g-py24-1.i386.deb 再安装deb sudo dpkg -i cx_Oracle-4.3-10g-py24-1.i386.deb 安装完成后在python里输入 >>> import cx_Oracle Traceback (most recent call last): File "", line 1, in ? ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory 经过查找发现是oracle的路径没有设置 输入: locate libclntsh.so.10.1 获取对于路径 /app/oracle/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1 编辑/etc/ld.so.conf sudo gedit /etc/ld.so.conf 在最后一行输入获取的路径 /app/oracle/oracle/product/10.2.0/db_1/lib/ 保存,关闭gedit 执行 ldconfig 再调用就好了 |
» 猜你喜欢
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
实验室接单子
已经有7人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复













回复此楼