=============
pydrda
=============
This is a DRDA protocol (https://en.wikipedia.org/wiki/DRDA) database driver.
- Pure python
- Compliant with PEP-249 (https://www.python.org/dev/peps/pep-0249/)
Requirements
=============
- Python 3.8+
Installation
=============
::
$ pip install pydrda
If you want to connect to Db2, you may need to install pyDes.
::
$ pip install pyDes
Supported Databases
======================
Db2
------------------------
https://www.ibm.com/analytics/db2
Example
No SSL
+++++++++++++++++++++++++++++++++++++++++
::
import drda
conn = drda.connect(host='serverhost', database='dbname', user='user', password='password', port=xxxxx)
cur = conn.cursor()
cur.execute('select * from foo where name=?', ['alice'])
for r in cur.fetchall():
print(r[0], r[1])
With SSL connection
+++++++++++++++++++++++++++++++++++++++++
::
import drda
conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, user='user', password='password', port=xxxxx)
cur = conn.cursor()
cur.execute('select * from foo where name=?', ['alice'])
for r in cur.fetchall():
print(r[0], r[1])
With SSL and client certificate
+++++++++++++++++++++++++++++++++++++++++
::
import drda
conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, ssl_client_cert_path='/some/what/path/cert.crt', user='user', password='password', port=xxxxx)
Apache Derby
==============
https://db.apache.org/derby/
You need to start derby as a network server.
http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#start_ns
Example
::
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])
This driver can't execute with parameters against Apache Derby.
Unit Tests
================
I have tested the following steps.
Db2
------
Start Db2 server
::
$ docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=password -e DBNAME=testdb --platform=linux/amd64 icr.io/db2_community/db2
Execute test
::
$ python test_db2.py
Apache Derby
---------------
Install Apatch Derby https://db.apache.org/derby/ and start as a server
::
$ curl -O https://downloads.apache.org//db/derby/db-derby-10.15.2.0/db-derby-10.15.2.0-bin.tar.gz
$ tar zxf db-derby-10.15.2.0-bin.tar.gz
$ echo 'grant {permission java.lang.RuntimePermission "getenv.SOURCE_DATE_EPOCH", "read";};' > ${HOME}/.java.policy
$ db-derby-10.15.2.0-bin/bin/startNetworkServer &
Execute test
::
$ python test_derby.py
Raw data
{
"_id": null,
"home_page": "https://github.com/nakagami/pydrda/",
"name": "pydrda",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Db2, Apache Derby",
"author": "Hajime Nakagami",
"author_email": "nakagami@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/86/6d/e97935ea1b23572aecb2c0de2d433554624c76d36b0584b7b4b11100312d/pydrda-0.5.1.tar.gz",
"platform": null,
"description": "=============\npydrda\n=============\n\nThis is a DRDA protocol (https://en.wikipedia.org/wiki/DRDA) database driver.\n\n- Pure python\n- Compliant with PEP-249 (https://www.python.org/dev/peps/pep-0249/)\n\nRequirements\n=============\n\n- Python 3.8+\n\n\nInstallation\n=============\n\n::\n\n $ pip install pydrda\n\nIf you want to connect to Db2, you may need to install pyDes.\n\n::\n\n $ pip install pyDes\n\n\nSupported Databases\n======================\n\n\nDb2\n------------------------\n\nhttps://www.ibm.com/analytics/db2\n\nExample\n\nNo SSL\n+++++++++++++++++++++++++++++++++++++++++\n\n::\n\n import drda\n\n conn = drda.connect(host='serverhost', database='dbname', user='user', password='password', port=xxxxx)\n cur = conn.cursor()\n cur.execute('select * from foo where name=?', ['alice'])\n for r in cur.fetchall():\n print(r[0], r[1])\n\nWith SSL connection\n+++++++++++++++++++++++++++++++++++++++++\n\n::\n\n import drda\n\n conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, user='user', password='password', port=xxxxx)\n cur = conn.cursor()\n cur.execute('select * from foo where name=?', ['alice'])\n for r in cur.fetchall():\n print(r[0], r[1])\n\nWith SSL and client certificate\n+++++++++++++++++++++++++++++++++++++++++\n\n::\n\n import drda\n\n conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, ssl_client_cert_path='/some/what/path/cert.crt', user='user', password='password', port=xxxxx)\n\n\n\nApache Derby\n==============\n\nhttps://db.apache.org/derby/\n\nYou need to start derby as a network server.\nhttp://db.apache.org/derby/papers/DerbyTut/ns_intro.html#start_ns\n\nExample\n\n::\n\n import drda\n\n conn = drda.connect(host='serverhost', database='dbname', port=1527)\n cur = conn.cursor()\n cur.execute('select * from foo')\n for r in cur.fetchall():\n print(r[0], r[1])\n\nThis driver can't execute with parameters against Apache Derby.\n\nUnit Tests\n================\n\nI have tested the following steps.\n\nDb2\n------\n\nStart Db2 server\n::\n\n $ docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=password -e DBNAME=testdb --platform=linux/amd64 icr.io/db2_community/db2\n\nExecute test\n::\n\n $ python test_db2.py\n\nApache Derby\n---------------\n\nInstall Apatch Derby https://db.apache.org/derby/ and start as a server\n::\n\n $ curl -O https://downloads.apache.org//db/derby/db-derby-10.15.2.0/db-derby-10.15.2.0-bin.tar.gz\n $ tar zxf db-derby-10.15.2.0-bin.tar.gz\n $ echo 'grant {permission java.lang.RuntimePermission \"getenv.SOURCE_DATE_EPOCH\", \"read\";};' > ${HOME}/.java.policy\n $ db-derby-10.15.2.0-bin/bin/startNetworkServer &\n\nExecute test\n::\n\n $ python test_derby.py\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "DRDA protocol database driver",
"version": "0.5.1",
"project_urls": {
"Homepage": "https://github.com/nakagami/pydrda/"
},
"split_keywords": [
"db2",
" apache derby"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "866de97935ea1b23572aecb2c0de2d433554624c76d36b0584b7b4b11100312d",
"md5": "56ea66183561632e9f09ac0cb5ead0eb",
"sha256": "ba8e44606a9cc923d641c556437dc834a63f449e80a84d1ff3513ae3b00709c2"
},
"downloads": -1,
"filename": "pydrda-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "56ea66183561632e9f09ac0cb5ead0eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15687,
"upload_time": "2024-03-31T06:51:06",
"upload_time_iso_8601": "2024-03-31T06:51:06.021817Z",
"url": "https://files.pythonhosted.org/packages/86/6d/e97935ea1b23572aecb2c0de2d433554624c76d36b0584b7b4b11100312d/pydrda-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-31 06:51:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nakagami",
"github_project": "pydrda",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pydrda"
}