DRDA协议数据库驱动程序
pydrda的Python项目详细描述
这是一个drda协议(https://en.wikipedia.org/wiki/DRDA)数据库驱动程序。
- 纯Python
- 符合PEP-249(https://www.python.org/dev/peps/pep-0249/)
要求
- Python3.5+
安装
$ pip install pydrda
支持的数据库
db2
https://www.ibm.com/analytics/db2
示例
import drda conn = drda.connect(host='serverhost', database='dbname', user='user', password='password', port=50000) cur = conn.cursor() cur.execute('select * from foo where name=?', ['alice']) for r in cur.fetchall(): print(r[0], r[1])
(使用SSL连接)
import drda conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, user='user', password='password', port=50001) cur = conn.cursor() cur.execute('select * from foo where name=?', ['alice']) for r in cur.fetchall(): print(r[0], r[1])
apache derby
你需要启动网络服务器。http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#start_ns
示例
import drda conn = drda.connect(host='serverhost', database='dbname', port=1527) cur = conn.cursor() cur.execute('select * from foo') for r in cur.fetchall(): print(r[0], r[1])
此驱动程序无法使用参数针对apache derby执行。