Open Source RDBMS - Seamless, Scalable, Stable and Free

English | Login |Register

Scriptella for CUBRID

Scriptella logo icon

Scriptella 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.

We strongly recommend Scriptella when any ETL operation is needed mainly because:

  • It has support for multiple data sources (or multiple connections to a single database) in an ETL script file.
  • It has support for many useful JDBC features, e.g. parameters in SQL including references to file BLOBs/CLOBs and JDBC “escaping”.
  • It has very good Execution Performance.
  • It supports Transactional execution.
  • 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.
  • 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
    http://scriptella.javaforge.com/reference/drivers.html#jdbcbridge.
  • It has Built-In support for CSV, Excel, Text, XML, LDAP, Lucene, Velocity, JEXL and Janino providers.
  • It is Open Source.
  • It is actively maintained and developed.

Downloads

You can download Scriptella from http://scriptella.javaforge.com/download.html.

Instructions

Prerequisites

In order to use Scriptella with Cubrid, you will need the following pre-requisites:

  • CUBRID Database Server version R2.0 or later. Remember, before you use Scriptella, make sure the CUBRID Service has been started. If the CUBRID Service has not been started, you can always start it manually or using the CUBRID Manager.
  • Java SE (Standard Edition)
    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
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
  • Scriptella itself. Download it from the link provided above. The latest Scriptella that supports CUBRID is version 1.0.

Not mandatory, but also recommended:

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

Configurations

The CUBRID JDBC Driver uses the following formatting:

Driver name: cubrid.jdbc.driver.CUBRIDDriver
Url: jdbc:CUBRID:<hostname>:<broker port>:<database name>:<user name>:<password>:

Example:
driver=cubrid.jdbc.driver.CUBRIDDriver
url=jdbc:CUBRID:127.0.0.1:30000:demodb:::

A typical ".properties" file will have this content:
driver=cubrid.jdbc.driver.CUBRIDDriver
url=jdbc:CUBRID:127.0.0.1:30000:demodb:::
user=dba
password=

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

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.

Examples

Select and Output data to the console

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
	<properties>
		<include href="/etl_05.properties" />
	</properties>

	<connection id="in" driver="${driver}" url="${url}" user="${user}" password="${password}" classpath="../lib/JDBC-8.3.0.0150.jar" lazy-init="false" />

	<connection id="console" driver="text" lazy-init="false" />

	<query connection-id="in">
		SELECT * FROM ${table_name}

		<script connection-id="console" new-tx="false">Name:[${name}], Continent:[${continent}], Capital:[${capital}]</script>

	</query>
</etl>

Select and Output data to a CVS File

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
	<properties>
		<include href="/etl_03.properties" />
	</properties>

	<connection id="in" driver="${driver}" url="${url}" user="${user}" password="${password}" classpath="../lib/JDBC-8.3.0.0150.jar" />

	<connection id="out" driver="csv" url="${table_name}_${etl.date.now('dd_MM_yyyy')}.csv" />

	<query connection-id="in">
		SELECT * FROM ${table_name}

		<script connection-id="out">
			5
			$code, $name, $continent, $capital
		</script>

	</query>
</etl>

Cubrid JDBC Java Example

import java.sql.*;

public class selectData
{
	public static void main(String[] args) throws Exception
	{
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;

		try
		{
			Class.forName("cubrid.jdbc.driver.CUBRIDDriver"); // 1

			conn = DriverManager.getConnection("jdbc:CUBRID:localhost:33000:subway:::","","");

			String sql = "select line_id, line from line";
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql);

			while(rs.next()) {
				String line_id = rs.getString("line_id");
				String line = rs.getString("line");

				System.out.println("Line_id ==> " + line_id);
				System.out.println("Line Name==> " + line);
				System.out.println("
=========================
");
			}

			rs.close();
			stmt.close();
			conn.close();

		}
		catch ( SQLException e )
		{
			System.err.println(e.getMessage());
		}
		catch ( Exception e )
		{
			System.err.println(e.getMessage());
		}
		finally
		{
			if ( conn != null )
				conn.close();
		}
	}
}

Tutorials

Getting Help

If you have any difficulties with using Scriptella with CUBRID, post your questions to the dedicated forum at CUBRID Apps & Tools forum.




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: