{"library":"jaydebeapi","title":"JayDeBeApi","description":"The JayDeBeApi module allows Python (cPython) and Jython code to connect to databases using Java JDBC drivers, providing a Python DB-API v2.0 compliant interface. It aims to offer a unified and fast interface through a flexible plug-in mechanism. The current version is 1.2.3, released in June 2020, indicating an infrequent release cadence.","status":"active","version":"1.2.3","language":"en","source_language":"en","source_url":"https://github.com/baztian/jaydebeapi","tags":["database","jdbc","db-api","java","jpype","jython","sql"],"install":[{"cmd":"pip install JayDeBeApi","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for cPython integration with Java, enabling JDBC driver usage. Specific versions (e.g., 0.6.3, 0.7.5 for Python 3) are noted for compatibility.","package":"JPype1","optional":false},{"reason":"JayDeBeApi relies on a functional Java environment and JDBC drivers to operate.","package":"Java Runtime Environment (JRE)","optional":false}],"imports":[{"symbol":"jaydebeapi","correct":"import jaydebeapi"}],"quickstart":{"code":"import jaydebeapi\nimport os\n\n# NOTE: Replace with your actual JDBC driver path, class name, and connection details\n# For example, using a placeholder for a generic JDBC driver (e.g., PostgreSQL)\nJDBC_DRIVER_PATH = os.environ.get('JDBC_DRIVER_PATH', '/path/to/your/jdbc_driver.jar')\nJDBC_DRIVER_CLASS = os.environ.get('JDBC_DRIVER_CLASS', 'org.postgresql.Driver')\nJDBC_URL = os.environ.get('JDBC_URL', 'jdbc:postgresql://localhost:5432/mydatabase')\nDB_USER = os.environ.get('DB_USER', 'user')\nDB_PASSWORD = os.environ.get('DB_PASSWORD', 'password')\n\ntry:\n    conn = jaydebeapi.connect(\n        JDBC_DRIVER_CLASS,\n        JDBC_URL,\n        [DB_USER, DB_PASSWORD],\n        JDBC_DRIVER_PATH\n    )\n    cursor = conn.cursor()\n    cursor.execute(\"SELECT 'Hello, JayDeBeApi!' AS message\")\n    result = cursor.fetchone()\n    print(f\"Connection successful: {result[0]}\")\n    cursor.close()\n    conn.close()\nexcept Exception as e:\n    print(f\"Error connecting to database: {e}\")\n    print(\"Please ensure your JDBC driver path, class name, URL, and credentials are correct, and that a compatible JRE is installed and JAVA_HOME is set if necessary.\")\n","lang":"python","description":"This quickstart demonstrates how to establish a connection to a database using `jaydebeapi`. You need to provide the path to your JDBC driver JAR file, the fully qualified Java class name of the driver, the JDBC connection URL, and your database credentials. Remember to set the `JDBC_DRIVER_PATH`, `JDBC_DRIVER_CLASS`, `JDBC_URL`, `DB_USER`, and `DB_PASSWORD` environment variables or replace the placeholders."},"warnings":[{"fix":"Update your `jaydebeapi.connect()` calls to use the `driver_args` parameter (as a dictionary or sequence of username/password) and `jars` parameter for driver JAR paths, as documented in versions 1.0.0 and above.","message":"The `connect` method signature changed significantly in JayDeBeApi 1.0.0. Older code using positional arguments for connection properties may break.","severity":"breaking","affected_versions":"< 1.0.0"},{"fix":"Upgrade JayDeBeApi to version 1.2.1 or newer (`pip install --upgrade JayDeBeApi`) to ensure compatibility with JPype1 0.7.2+. Ensure your JPype1 version is also compatible with your Python version.","message":"Incompatibility issues with certain JPype1 versions, particularly older JayDeBeApi versions with JPype1 0.7.2+. This can lead to connection errors or crashes.","severity":"gotcha","affected_versions":"< 1.2.1"},{"fix":"Ensure a Java Runtime Environment (JRE) or Java Development Kit (JDK) is installed and the `JAVA_HOME` environment variable is correctly set, pointing to your Java installation directory. Also, ensure the Java architecture (32-bit vs. 64-bit) matches your Python installation.","message":"JVM shared library not found errors (e.g., `No JVM shared library file (libjvm.so) found`) are common. This typically means the Java Virtual Machine cannot be located.","severity":"gotcha","affected_versions":"All"},{"fix":"Verify the `jars` parameter in `jaydebeapi.connect()` points to the correct, absolute path of your JDBC driver JAR file. Alternatively, ensure the `CLASSPATH` environment variable includes the path to your JDBC driver JARs before starting your Python script.","message":"Errors like `java.lang.RuntimeException: Class <driver_class_name> not found` indicate that the JDBC driver JAR file is not correctly located or loaded by the JVM.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure that the architecture (32-bit or 64-bit) of your Python installation matches that of your Java Runtime Environment (JRE) or Java Development Kit (JDK) installation.","message":"Mixing 32-bit Python with 64-bit Java (or vice versa) can cause `jpype` to crash, leading to unexpected program termination without clear Python exceptions.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}