scriptella.jdbc

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » Scripting » scriptella » scriptella.jdbc 
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:

  • $ prefixed expressions are substituted in all parts except comments.
  • ? prefixed expressions are not substituted inside quotes and comments.

  • Example:
    --only ${prop} and ?surname are handled
         SELECT * FROM "Table" WHERE NAME="?John${prop}" and SURNAME=?surname;
        

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 NameTypeComment
AutocommitITest.javaClass Integration tests for scriptella.jdbc.JdbcConnection.autocommit and scriptella.jdbc.JdbcConnection.autocommitSize parameters.
CachedSqlTokenizer.javaClass This tokenizer uses target to tokenize statements and remembers parsed statements and injections, so it can be reset and iterated several times.
CachedSqlTokenizerTest.javaClass Tests for CachedSqlTokenizer .
GenericDriver.javaClass Generic adapter for JDBC drivers.
JdbcConnection.javaClass Represents a JDBC connection.
JdbcConnectionITest.javaClass Integration test for JDBC connection.
JdbcException.javaClass Unchecked wrapper for SQL exceptions or other SQL related errors.
JdbcTypesConverter.javaClass 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.javaClass Utility class JDBC related operations.
Lobs.javaClass Factory for LOBs.
LobsTest.javaClass Tests for Lobs .
NestedElementsPerfTest.javaClass Tests for nested elements handling.
ParametersParser.javaClass Parses parameter expressions in SQL statements.
ParametersParserTest.javaClass Tests for ParametersParser .
QueryHelper.javaClass Query abstraction to for tests.
ResultSetAdapter.javaClass Represents SQL query result set as ParametersCallback .
SqlExecutor.javaClass SQL statements executor.
SqlParserBase.javaClass Customizable SQL parser.
SQLParserBaseTest.javaClass Tests scriptella.jdbc.SqlParserBase .
SqlReaderTokenizer.javaClass Reader based SQL tokenizer.
SqlTokenizer.javaInterface This interface provides a contract to iterate SQL statements.
SqlTokenizerITest.javaClass Integration test for SqlReaderTokenizer .
SqlTokenizerPerfTest.javaClass Performance tests for SqlReaderTokenizer .
SqlTokenizerTest.javaClass Tests for SqlReaderTokenizer .
StatementCache.javaClass Statements cache for JdbcConnection .
StatementCachePerfTest.javaClass Performance tests for scriptella.jdbc.StatementCache .
StatementCacheTest.javaClass Tests for StatementCache .
StatementWrapper.javaClass Abstraction for java.sql.Statement and java.sql.PreparedStatement .
w___w_w_.__j__a__v__a___2__s___.___c___o___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.