V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
tomkliyes
V2EX  ›  Python

Python cx_Oracle 的使用问题

  •  
  •   tomkliyes · 2017-07-18 16:06:11 +08:00 · 2482 次点击
    这是一个创建于 2471 天前的主题,其中的信息可能已经有所发展或是发生改变。

    项目中用到了 cx_Oracle 来连接和操作 Oracle 数据库,调用存储过程函数时遇到传入参数类型的问题,请用过的大神支招。 具体是这样的,我想使用 Oracle 的 DBMS_FGA 来进行数据库审计,用 sql 语句添加审计策略没有任何问题,现在在 python 中使用 cx_Oracle,调用 Cursor.callproc 方法时,遇到问题:

    cursor.callproc("DBMS_FGA.ADD_POLICY", [], {
        "object_name": "BOOKS",
        "policy_name": "ORC_2_p2_BOOKS",
        "audit_condition": None,
        "audit_column": None,
        "handler_schema": None,
        "handler_module": None,
        "enable": False
    })
    

    报错:ORA-03115: unsupported network datatype or representation 去掉"enable"参数就可以执行成功,我猜测是 bool 类型的输入不能直接这样传。试过传 0,"FALSE"都不行,Google 了一圈也没找到解决方案,求大神赐教!

    1 条回复    2017-07-18 17:28:56 +08:00
    tomkliyes
        1
    tomkliyes  
    OP
       2017-07-18 17:28:56 +08:00
    self-solved ……原来是编译 cx_Oracle 时所用的 client 版本和实际数据库版本不一致引起的问题……蛋疼啊,折腾一天了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3288 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:27 · PVG 21:27 · LAX 06:27 · JFK 09:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.