Registry / database / pyjdbc

pyjdbc

JSON →
library0.2.2pypypi✓ verified 87d ago

A Python library that provides a DB-API 2.0 interface using JDBC drivers, enabling Python applications to connect to databases via JDBC bridges. Current version 0.2.2, with infrequent releases.

pip install pyjdbc
INSTALL
IMPORT
SIG · PYJDBC
P
pyjdbc
databasepythonv0.2.2
Install
2.1s avg
Import
80ms
Disk
19MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
build_error
glibc
py 3.103.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()
Debug
Known issues
gotchaThe connect function requires the 'driver' parameter pointing to a JDBC JAR file; without it, the connection fails.
fix
Always provide the full path to the JDBC driver JAR when calling connect().
affects: >=0.1.0
deprecatedOlder versions (0.1.x) had a different API; the 'driver' parameter was optional and defaulted to a bundled Hive driver. In 0.2.x, the driver must be explicitly specified.
fix
Update your connect() calls to include the driver parameter.
affects: 0.1.x
breakingVersion 0.2.0 changed the signature of the connect function; the 'driver' parameter is now required and the JAAS configuration handling has changed.
fix
Ensure you pass the driver JAR path and review JAAS config usage.
affects: 0.1.x -> 0.2.x
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.
fix
Upgrade 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.
fix
Ensure 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.
fix
Check 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.

Agent activity
9 hits · last 30 days
node
8
Resources
pyjdbc — pip install pyjdbc · libregistry