全部版块 我的主页
论坛 数据科学与人工智能 大数据分析 Oracle数据库及大数据解决方案
818 2
2024-06-17
python连接oracle数据库的新模块
从原来的cx_Oralce更新为oracldb
cx_Oracle has a major new release under a new name and homepagepython-oracledb.
New projects should install python-oracledb instead of cx_Oracle.
https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html
https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_c.html#upgrading83


使用方法:
import oracledb

You must replace positional parameters with keyword parameters, unlessonly one parameter is being passed. Python-oracledb uses keyword parametersexclusively unless a DSN containing the user, password, and connect stringcombined, for example un/pw@cs, is used. This change makes the drivercompliant with the Python Database API specification PEP 249.
For example, the following code will fail:
c = oracledb.connect("un", "pw", "cs")

and needs to be changed to:
c = oracledb.connect(user="un", password="pw", dsn="cs")

The following example will continue to work without change:
c = oracledb.connect("un/pw@cs")

eg:
c=oracledb.connect('user/pwd@192.168.1.1:1521/your_db_name')





二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2024-6-19 08:58:39
Well Done! Girl!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2024-6-19 08:59:12
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群