As specified in Service Provider API all JDBC drivers are registered via this bridge. This procedure is transparent to end user, he only have to specify jdbc driver class name or an alias.
| Driver class: | JDBC driver class name |
| URL: | JDBC driver URL, e.g. jdbc:mydb:... |
| Runtime dependencies: | Set of libraries required by the JDBC driver. |
JDBC bridge makes the following configuration properties available in configuration element:
| Name | Description | Required |
|---|---|---|
| statement.cache | Size of prepared statements cache or 0 to disable statement caching. | No, the default value is 64. |
| statement.separator | SQL statements separator string. Similar to Ant delimiter property. | No, the default value is ; (semicolon). |
| statement.separator.singleline | True if the delimiter should only be recognized on a line by itself. Leading and trailing whitespaces are
ignored when searching for a separator in statement.separator.singleline=true mode.
Similar to Ant delimitertype property. |
No, the default value is false. |
| keepformat | True if the original SQL formatting should be preserved.
This property is similar to Ant keepformat property except that Oracle-style hints (?*+ hint */) are always preserved in Scriptella. |
No, the default value is false, i.e. extra whitespaces and comments removed. |
| transaction.isolation | Transaction isolation level name or an integer value according to java.sql.Connection
javadoc.
The valid level names are: READ_UNCOMMITTED, READ_COMMITTED,
REPEATABLE_READ and SERIALIZABLE.
| No, the default value is driver specific. |
| autocommit | True if connection is in auto-commit mode. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed
as individual transactions.See also autocommit.size.
Note: In general avoid setting autocommit to true, because in this case an ETL process cannot be rolled back correctly. Use this parameter only for performance critical operations (bulk inserts etc.). |
No, the default value is false. |
| autocommit.size | If positive, specifies the number of statements to execute before producing implicit commit,
i.e. controls how much data is committed in its batches.
Notes:
|
No, the default value is false. |
Example:
var=_name
id=11
--------------------------------------
select * FROM table${var} where id=?id
-- is transformed to a JDBC prepared statement---
select * FROM table_name where id=?
-- where parameter id=11
Notes:
--only ${prop} and ?surname are handled
SELECT * FROM "Table" WHERE NAME="?John${prop}" and SURNAME=?surname;
<connection id="in" driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:file:tmp" user="sa" classpath="hsqldb.jar">
#Disable cache - just for example
statement.cache=0
#Set SQL statements separator
statement.separator=;
</connection>
<connection id="out" driver="h2" url="jdbc:h2:file:out" user="sa"/>
<query connection-id="in">
SELECT * from Bug
<script connection-id="out">
INSERT INTO Bug VALUES (?ID, ?priority, ?summary, ?status);
</script>
</query>