{"id":21754,"library":"pyjdbc","title":"pyjdbc","description":"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.","status":"active","version":"0.2.2","language":"python","source_language":"en","source_url":"https://github.com/OpenBigDataPlatform/pyjdbc","tags":["jdbc","database","db-api2.0","py4j","java-bridge"],"install":[{"cmd":"pip install pyjdbc","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Direct import of connect is required; importing the module alone does not expose connect.","wrong":"import pyjdbc","symbol":"connect","correct":"from pyjdbc import connect"},{"note":"Drivers are under pyjdbc.drivers submodule, not top-level.","wrong":"from pyjdbc import apache_hive_driver","symbol":"apache_hive_driver","correct":"from pyjdbc.drivers import apache_hive_driver"}],"quickstart":{"code":"from pyjdbc import connect\n\nconn = connect('jdbc:postgresql://localhost:5432/mydb', driver='/path/to/postgresql.jar', user='user', password='pass')\ncursor = conn.cursor()\ncursor.execute('SELECT 1')\nprint(cursor.fetchone())\ncursor.close()\nconn.close()","lang":"python","description":"Basic usage: connect using a JDBC URL and driver JAR path, then execute SQL."},"warnings":[{"fix":"Always provide the full path to the JDBC driver JAR when calling connect().","message":"The connect function requires the 'driver' parameter pointing to a JDBC JAR file; without it, the connection fails.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Update your connect() calls to include the driver parameter.","message":"Older 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.","severity":"deprecated","affected_versions":"0.1.x"},{"fix":"Ensure you pass the driver JAR path and review JAAS config usage.","message":"Version 0.2.0 changed the signature of the connect function; the 'driver' parameter is now required and the JAAS configuration handling has changed.","severity":"breaking","affected_versions":"0.1.x -> 0.2.x"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade to pyjdbc>=0.2.0 and use 'from pyjdbc import connect'.","cause":"Running an older version (0.1.x) where connect was not exported at top level, or incorrect import.","error":"ImportError: cannot import name 'connect' from 'pyjdbc'"},{"fix":"Ensure Java is installed and set JAVA_HOME. Provide the correct absolute path to the JDBC driver JAR in the connect() call.","cause":"Missing or incorrect JDBC driver JAR path, or Java is not installed/configured correctly.","error":"py4j.protocol.Py4JError: An error occurred while trying to connect to the Java server"},{"fix":"Check that no other process is using port 25333 (default). Restart your Python process.","cause":"Py4J gateway failed to start, often due to port conflicts or insufficient permissions.","error":"py4j.protocol.Py4JNetworkError: Answer from Java side is empty"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}