<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
    <channel>
        <title>Scriptella for CUBRID</title>
        <link>http://www.cubrid.org/?mid=about_scriptella</link>
        <description>Scriptella for CUBRID</description>
        <language>en</language>
        <pubDate>Thu, 03 Jun 2010 19:18:24 -0800</pubDate>
        <lastBuildDate>Thu, 13 Dec 2012 04:02:28 -0800</lastBuildDate>
        <generator>XpressEngine 1.4.4.1</generator>
                        										        <item>
            <title>Scriptella for CU...</title>
            <dc:creator>CUBRID</dc:creator>
            <link>http://www.cubrid.org/about_scriptella</link>
            <guid isPermaLink="true">http://www.cubrid.org/about_scriptella</guid>
                                    <description><![CDATA[<h1>Scriptella for CUBRID</h1>

<img editor_component="image_link" src="/files/attach/images/scriptella/scriptella.jpg" title="Scriptella for CUBRID" alt="Scriptella logo icon" style="float: left; margin: 0pt 10px 5px 0pt; border: 0pt none; padding: 0pt;"/>
<p class="inline"><a href="http://scriptella.javaforge.com/" target="_blank">Scriptella</a> is an open source ETL (Extract-Transform-Load) and Script Execution Software Tool written in Java. It is licensed under the Apache License, Version 2.0.</p>

<p>We strongly recommend Scriptella when any ETL operation is needed mainly because:</p>
<ul>
<li>It has support for multiple data sources (or multiple connections to a single database) in an ETL script file.</li>
<li>It has support for many useful JDBC features, e.g. parameters in SQL including references to file BLOBs/CLOBs and JDBC “escaping”.</li>
<li>It has very good Execution Performance.</li>
<li>It supports Transactional execution.</li>
<li>It is Easy-to-Use as a standalone tool or as an Ant task. No deployment/installation required. You can also execute/call it directly from Java code.</li>
<li>It has Built-in adapters for popular databases. It has support for any database with JDBC/ODBC compliant driver. CUBRID is one of the the built-in adapters<br /><a target="_blank" href="http://scriptella.javaforge.com/reference/drivers.html#jdbcbridge">http://scriptella.javaforge.com/reference/drivers.html#jdbcbridge</a>.</li>
<li>It has Built-In support for CSV, Excel, Text, XML, LDAP, Lucene, Velocity, JEXL and Janino providers.</li>
<li>It is Open Source.</li>
<li>It is actively maintained and developed.</li>
</ul>

<h2>Downloads</h2>

<p>You can download Scriptella from&nbsp;<a target="_blank" href="http://scriptella.javaforge.com/download.html">http://scriptella.javaforge.com/download.html</a>.</p>

<h2>Instructions</h2>

<h3>Prerequisites</h3>

<p>In order to use Scriptella with Cubrid, you will need the following pre-requisites:</p>
<ul>
<li><b>CUBRID Database Server</b> version R2.0 or later. Remember, before you use Scriptella, <a href="/manual/840/en/Checking%20Database%20Server%20Status" target="_blank">make sure</a> the CUBRID Service has been started. If the CUBRID Service has not been started, you can always <a href="/manual/840/en/Starting%20and%20Stopping%20Servicess" target="_blank">start it manually</a> or using the <a href="/wiki_tutorials/entry/CUBRID_Service_through_CUBRID_Manager" target="_blank">CUBRID Manager</a>.</li>
<li><b>Java SE (Standard Edition)<br /></b>JRE (Java Runtime Environment) or JDK (Java Development Kit) v1.6 or later should be install. We recommend installing Java in a location different from "Program Files" or any other location that contains "spaces" in names. You can download JRE or JDK from this link<br /><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a></li>
<li><b>Scriptella</b> itself. Download it from the link provided above. The latest Scriptella that supports CUBRID is version 1.0.</li>
</ul>

<p>Not mandatory, but also recommended:</p>

<ul>
<li><b>Ant</b> ? needed to run Scriptella scripts from Ant</li>
<li><b>Janino</b> ? needed to “script” in Java in Scriptella scripts. You will need the “<b>Janino.jar</b>” driver, which you can get it from<br /><a target="_blank" href="http://docs.codehaus.org/display/JANINO/Download#Download-packages">http://docs.codehaus.org/display/JANINO/Download#Download-packages</a>.</li>
</ul>

<p>We also recommend copying the CUBRID JDBC Driver ("<b>C:/CUBRID/jdbc/cubrid_jdbc.jar</b>"), to the Scriptella "<b>lib</b>" folder.</p>

<h3>Configurations</h3>

<p>The CUBRID JDBC Driver uses the following formatting:</p>

<p><b>Driver name:</b> <i>cubrid.jdbc.driver.CUBRIDDriver</i><br /><b>Url:</b><i> jdbc:CUBRID:&lt;hostname&gt;:&lt;broker port&gt;:&lt;database name&gt;:&lt;user name&gt;:&lt;password&gt;:</i></p>

<p>Example:<br /><i><span class="Apple-style-span" style="font-style: normal;"><b>driver</b></span>=cubrid.jdbc.driver.CUBRIDDriver</i><br /><i><b><span class="Apple-style-span" style="font-style: normal;">url</span></b>=jdbc:CUBRID:127.0.0.1:30000:demodb:::</i></p>

<p>A typical "<b>.properties</b>" file will have this content:<br /><b>driver</b>=<i>cubrid.jdbc.driver.CUBRIDDriver</i><br /><b>url</b>=<i>jdbc:CUBRID:127.0.0.1:30000:demodb:::</i><br /><b>user</b>=<i>dba</i><br /><b>password</b>=</p>

<p>And the reference from the script files should be done like this:<br /><i>&lt;connection driver="${driver}" url="${url}" user="${user}" password="${password}" classpath="../lib/&lt;cubrid jdbc jar name&gt;.jar"/&gt;</i></p>

<p class="important">If you use Scriptella with multiple CUBRID databases, make sure you use different broker ports for each database connection. This is specific to CUBRID JDBC implementation.</p>

<h2>Examples</h2>

<h3>Select and Output data to the console</h3>
<div class="code" editor_component="code_highlighter" code_type="Xml" file_path="" description="" first_line="1" collapse="true" nogutter="false" nocontrols="false">
&lt;!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd"&gt;<br />
&lt;etl&gt;<br />
	&lt;properties&gt;<br />
		&lt;include href="/etl_05.properties" /&gt;<br />
	&lt;/properties&gt;<br />
<br />
	&lt;connection id="in" driver="${driver}" url="${url}" user="${user}" password="${password}" classpath="../lib/JDBC-8.3.0.0150.jar" lazy-init="false" /&gt;<br />
<br />
	&lt;connection id="console" driver="text" lazy-init="false" /&gt;<br />
<br />
	&lt;query connection-id="in"&gt;<br />
		SELECT * FROM ${table_name}<br />
<br />
		&lt;script connection-id="console" new-tx="false"&gt;Name:[${name}], Continent:[${continent}], Capital:[${capital}]&lt;/script&gt;<br />
<br />
	&lt;/query&gt;<br />
&lt;/etl&gt;<br />
</div>

<h3>Select and Output data to a CVS File</h3>

<div class="code" editor_component="code_highlighter" code_type="Xml" file_path="" description="" first_line="1" collapse="true" nogutter="false" nocontrols="false">
&lt;!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd"&gt;<br />
&lt;etl&gt;<br />
	&lt;properties&gt;<br />
		&lt;include href="/etl_03.properties" /&gt;<br />
	&lt;/properties&gt;<br />
<br />
	&lt;connection id="in" driver="${driver}" url="${url}" user="${user}" password="${password}" classpath="../lib/JDBC-8.3.0.0150.jar" /&gt;<br />
<br />
	&lt;connection id="out" driver="csv" url="${table_name}_${etl.date.now('dd_MM_yyyy')}.csv" /&gt;<br />
<br />
	&lt;query connection-id="in"&gt;<br />
		SELECT * FROM ${table_name}<br />
<br />
		&lt;script connection-id="out"&gt;<br />
			5<br />
			$code, $name, $continent, $capital<br />
		&lt;/script&gt;<br />
<br />
	&lt;/query&gt;<br />
&lt;/etl&gt;<br />
</div>

<h3>Cubrid JDBC Java Example</h3>

<div class="code" editor_component="code_highlighter" code_type="Java" file_path="" description="" first_line="1" collapse="true" nogutter="false" nocontrols="false">
import java.sql.*;<br />
<br />
public class selectData<br />
{<br />
	public static void main(String[] args) throws Exception<br />
	{<br />
		Connection conn = null;<br />
		Statement stmt = null;<br />
		ResultSet rs = null;<br />
<br />
		try<br />
		{<br />
			Class.forName("cubrid.jdbc.driver.CUBRIDDriver"); // 1<br />
<br />
			conn = DriverManager.getConnection("jdbc:CUBRID:localhost:33000:subway:::","","");<br />
<br />
			String sql = "select line_id, line from line";<br />
			stmt = conn.createStatement();<br />
			rs = stmt.executeQuery(sql);<br />
<br />
			while(rs.next()) {<br />
				String line_id = rs.getString("line_id");<br />
				String line = rs.getString("line");<br />
<br />
				System.out.println("Line_id ==&gt; " + line_id);<br />
				System.out.println("Line Name==&gt; " + line);<br />
				System.out.println("<br />
=========================<br />
");<br />
			}<br />
<br />
			rs.close();<br />
			stmt.close();<br />
			conn.close();<br />
<br />
		}<br />
		catch ( SQLException e )<br />
		{<br />
			System.err.println(e.getMessage());<br />
		}<br />
		catch ( Exception e )<br />
		{<br />
			System.err.println(e.getMessage());<br />
		}<br />
		finally<br />
		{<br />
			if ( conn != null )<br />
				conn.close();<br />
		}<br />
	}<br />
}
</div>


<h2>Tutorials</h2>

<ul>
<li><a href="http://blog.cubrid.org/cubrid-videos/scriptella-for-cubrid-video-tutorial/" target="_blank">How to use Scriptella with CUBRID</a>&nbsp;- Video Tutorial</li>
<li>For more advanced examples you might want to read about<br /><a href="http://blog.cubrid.org/notice/apache-ddlutils-scriptella-migrating-to-cubrid/" target="_blank">How Apache DdlUtils and Scriptella help users to migrate their data to CUBRID</a></li>
<li><a href="/ddlutils_scriptella_database_migration" target="_self">Use Apache DdlUtils and Scriptella to migrate databases to CUBRID</a></li>
</ul>

<h2>Getting Help</h2>

<p>If you have any difficulties with using Scriptella with CUBRID, post your questions to the dedicated forum at <a href="/?mid=forum&amp;category=195523&amp;act=dispForumContent" target="_blank">CUBRID Apps &amp; Tools forum</a>.</p>]]></description>
                        <pubDate>Thu, 03 Jun 2010 18:55:11 -0800</pubDate>
                                </item>
            </channel>
</rss>
