Install & Compatibility
Where this runs
tested against v0.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.1s · import 0.080s · 21MB
19MB installed
● package 19MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
connect
✓ from pyjdbc import connect
✗ import pyjdbc
Direct import of connect is required; importing the module alone does not expose connect.
apache_hive_driver
✓ from pyjdbc.drivers import apache_hive_driver
✗ from pyjdbc import apache_hive_driver
Drivers are under pyjdbc.drivers submodule, not top-level.
Basic usage: connect using a JDBC URL and driver JAR path, then execute SQL.
from pyjdbc import connect
conn = connect('jdbc:postgresql://localhost:5432/mydb', driver='/path/to/postgresql.jar', user='user', password='pass')
cursor = conn.cursor()
cursor.execute('SELECT 1')
print(cursor.fetchone())
cursor.close()
conn.close()
Errors
Common errors & fixes
ImportError: cannot import name 'connect' from 'pyjdbc'
Running an older version (0.1.x) where connect was not exported at top level, or incorrect import.
fixUpgrade to pyjdbc>=0.2.0 and use 'from pyjdbc import connect'.
py4j.protocol.Py4JError: An error occurred while trying to connect to the Java server
Missing or incorrect JDBC driver JAR path, or Java is not installed/configured correctly.
fixEnsure Java is installed and set JAVA_HOME. Provide the correct absolute path to the JDBC driver JAR in the connect() call.
py4j.protocol.Py4JNetworkError: Answer from Java side is empty
Py4J gateway failed to start, often due to port conflicts or insufficient permissions.
fixCheck that no other process is using port 25333 (default). Restart your Python process.
Upgrade
Version history
0.2.2latest on PyPI · released Jan 11, 2021
Audit
Dependencies
No dependency data recorded yet.