MySQL JDBC driver
Connect Scriptella to MySQL using the built-in mysql adapter and an external JDBC driver.
Install the JDBC driver
Download the official JDBC driver for Maven coordinate com.mysql:mysql-connector-j:26.7.0. Place mysql-connector-j-26.7.0.jar in a lib/ directory next to your ETL file.
JDBC class com.mysql.cj.jdbc.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="mysql"
url="jdbc:mysql://db.example.com:3306/app"
user="DEMO_USER" password="DEMO_PASSWORD"
classpath="lib/mysql-connector-j-26.7.0.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.
Verified with Scriptella 1.7.0
MySQL Server 8.4.11 with JDBC driver 26.7.0. One targeted packaged configuration passed connection, alias and URL selection, parameterized writes and reads, H2 migration in both directions, commit, and rollback.
Configuration notes
For queries that return many rows, add statement.fetchSize = -2147483648 inside the MySQL <connection> element. MySQL Connector/J treats this special value as a request to read rows one at a time, which keeps the driver from holding the entire result in memory.