PostgreSQL JDBC driver

Connect Scriptella to PostgreSQL using the built-in postgresql adapter and an external JDBC driver.

Install the JDBC driver

Download the official JDBC driver for Maven coordinate org.postgresql:postgresql:42.7.13. Place postgresql-42.7.13.jar in a lib/ directory next to your ETL file.

JDBC class org.postgresql.Driver. The example below shows the JDBC URL format.

Check the connection

Replace the sample host and database or service name. Replace DEMO_USER and DEMO_PASSWORD with your local demo credentials. Save this as check.etl.xml, then run scriptella.sh check.etl.xml. The read-only query passes the connection_ok column to the nested script, which prints CONNECTION OK: 1.

<?xml version="1.0"?>
<!DOCTYPE etl SYSTEM "http://scriptella.org/dtd/etl.dtd">
<etl>
    <connection id="db" driver="postgresql"
                url="jdbc:postgresql://db.example.com:5432/app"
                user="DEMO_USER" password="DEMO_PASSWORD"
                classpath="lib/postgresql-42.7.13.jar"/>
    <connection id="console" driver="text"/>
    <query connection-id="db">
        SELECT 1 AS connection_ok;
        <script connection-id="console">CONNECTION OK: $connection_ok</script>
    </query>
</etl>

Keep real passwords out of version control. For shared or deployed ETL files, set SCRIPTELLA_DB_USER and SCRIPTELLA_DB_PASSWORD in the process environment and use user="${env.SCRIPTELLA_DB_USER}" and password="${env.SCRIPTELLA_DB_PASSWORD}" in the connection.

Installation instructions · Download Scriptella

Verified with Scriptella 1.7.0

PostgreSQL 17.11 with JDBC driver 42.7.13. Packaged validation passed parameterized writes and reads, migration in both directions with H2, commit, and rollback. The public Testcontainers check passed ETL copy, representative values, and rollback.

Compatibility evidence · Public Testcontainers run

Import a CSV file

Follow the CSV import guide for a runnable example with PostgreSQL and Scriptella.

Export query results

Follow the PostgreSQL JSON export guide to write query results as JSON or JSON Lines.

Configuration notes

For large reads, configure a positive JDBC fetch size and keep autocommit off so pgJDBC can read through a cursor.

Adapter Javadoc