scriptella.jdbc |
Scriptella JDBC Bridge.
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.
General information
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 Properties
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 100. |
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:
- In general avoid using autocommit.size, because in this case an ETL process cannot be rolled back correctly.
Use this parameter only for performance critical operations (bulk inserts etc.).
- If the
autocommit is true ,
then setting autocommit.size has no effect
|
No, the default value is false . |
Properties Substitution
The bridge supports standard ${} variables expansion and
allows to set prepared statement parameters via ?{} syntax.
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:
Examples
<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>
|
Java Source File Name | Type | Comment |
AutocommitITest.java | Class | Integration tests for
scriptella.jdbc.JdbcConnection.autocommit and
scriptella.jdbc.JdbcConnection.autocommitSize parameters. |
CachedSqlTokenizer.java | Class | This tokenizer uses target to tokenize statements and remembers
parsed statements and injections, so it can be reset and iterated several times. |
CachedSqlTokenizerTest.java | Class | Tests for
CachedSqlTokenizer . |
GenericDriver.java | Class | Generic adapter for JDBC drivers. |
JdbcConnection.java | Class | Represents a JDBC connection. |
JdbcConnectionITest.java | Class | Integration test for JDBC connection. |
JdbcException.java | Class | Unchecked wrapper for SQL exceptions or other SQL related errors. |
JdbcTypesConverter.java | Class | Represents a converter for prepared statement parameters and result set columns.
This class defines a strategy for handling specific parameters like
URL and by default provides a generic behaviour for any objects.
Configuration by exception is the general philosophy of this class, i.e.
most of the conversions must be performed by a provided resultset/preparedstatement and
custom conversions are applied only in rare cases. |
JdbcUtils.java | Class | Utility class JDBC related operations. |
Lobs.java | Class | Factory for LOBs. |
LobsTest.java | Class | Tests for
Lobs . |
NestedElementsPerfTest.java | Class | Tests for nested elements handling. |
ParametersParser.java | Class | Parses parameter expressions in SQL statements. |
ParametersParserTest.java | Class | Tests for
ParametersParser . |
QueryHelper.java | Class | Query abstraction to for tests. |
ResultSetAdapter.java | Class | Represents SQL query result set as
ParametersCallback . |
SqlExecutor.java | Class | SQL statements executor. |
SqlParserBase.java | Class | Customizable SQL parser. |
SQLParserBaseTest.java | Class | Tests
scriptella.jdbc.SqlParserBase . |
SqlReaderTokenizer.java | Class | Reader based SQL tokenizer. |
SqlTokenizer.java | Interface | This interface provides a contract to iterate SQL statements. |
SqlTokenizerITest.java | Class | Integration test for
SqlReaderTokenizer . |
SqlTokenizerPerfTest.java | Class | Performance tests for
SqlReaderTokenizer . |
SqlTokenizerTest.java | Class | Tests for
SqlReaderTokenizer . |
StatementCache.java | Class | Statements cache for
JdbcConnection . |
StatementCachePerfTest.java | Class | Performance tests for
scriptella.jdbc.StatementCache . |
StatementCacheTest.java | Class | Tests for
StatementCache . |
StatementWrapper.java | Class | Abstraction for
java.sql.Statement and
java.sql.PreparedStatement . |