Oracle9i XML Developer's Kits Guide - XDK Release 2 (9.2) Part Number A96621-01 |
|
This chapter contains the following sections:
The TransX Utility simplifies the loading of translated seed data and messages into a database. It also reduces internationalization costs by:
The TransX Utility minimizes translation data format errors and it accurately loads the translation contents into pre-determined locations in the database. Other advantages of the TransX Utility are:
Development groups that need to load translated messages and seed data can use the TransX Utility to simplify what it takes for meeting internationalization requirements. Once the data is in a predefined format, the TransX Utility validates its format.
Choosing the correct encoding when loading translated data is automated because loading with TransX takes advantage of XML which describes the encoding. This means that loading errors due to incorrect encoding is impossible as long as the data file conforms to the XML standard.
This section describes the following features of the TransX Utility:
Traditionally, the typical translation data loading method was to switch the NLS_LANG
setting when you switch files to be loaded. Each of the load files is encoded in a particular character set suitable for the particular language. This was required because translations must be done in the same file format (typically in .sql script) as the original.
The NLS_LANG
setting changes as files are loaded to adapt to the character set that corresponds to the language. The TransX Utility loading tool frees the development and translation groups maintaining the correct character set throughout the process until they successfully load the data into the database using XML.
The TransX Utility data loading tool complies with a data format defined to be the canonical method for the representation of any seed data to be loaded to the database. The format is intuitive and easy to understand. The format is also simplified for translation groups to use. The format specification defines how translators can describe the data to load it in the expected way.
The data loading tool has a command-line interface and programmable API. Both of them are straightforward and require little time to learn.
Given the dataset in the canonical format, the TransX Utility loads the data into the designated locations in the database. It does not, however, create objects, including the table that the data is going to be loaded to. In addition to literal values represented in XML, the following expressions can be used to describe the data to be loaded:
A constant expression allows you to specify a constant value. A column with a fixed value for each row does not have to repeat the same value.
A column can be loaded with a value obtained from a sequence in the database.
A SQL query can be used to load a column. A query can use parameter(s).
The data loading tool determines whether there are duplicate rows in the database. It also lets you choose how it processes duplicate rows from one of the options in the following list. A row is considered duplicate if the values of all columns specified as lookup-key are the same. The processing options are:
The lists describes other TransX Utility features:
Here is how to install TransX, and the dependencies of TransX.
The Oracle TransX utility needs the following components in order to function:
TransX is packaged with Oracle9i. The TransX utility is made up of three executable files:
By default, the Oracle9i installer installs TransX on your hard drive in the locations specified above.
Download the correct XDK for java distribution archive from the Oracle Technology Network (http://otn.oracle.com). Expand the downloaded archive. Depending on the usage scenario, perform the following install tasks:
Set up the environment (that is, set CLASSPATH) using the env.xxx
script (located in the bin directory inside the directory created by extracting the XDK download archive):
Unix users: make sure that the path names in env.csh are correct; source the env.csh. If you are using a shell other than csh
or tcsh
, you will have to edit the file to use your shell's syntax.
Windows users: make sure that the path names in env.bat
are correct; execute the file.
The following describes the command-line syntax for the TransX Utility.
java oracle.xml.transx.loader [options] connect_string username password
datasource [datasource]
java oracle.xml.transx.loader -v datasource [datasource]
java oracle.xml.transx.loader -x connect_string username password table [column]
java oracle.xml.transx.loader -s connect_string
username password filename table
[column]
The following are command-line examples for the TransX Utility:
java oracle.xml.transx.loader "dlsun9999:1521:mydb" scott tiger foo.xml java oracle.xml.transx.loader "jdbc:oracle:oci:@mydb" scott tiger foo.xml java oracle.xml.transx.loader -v foo.xml java oracle.xml.transx.loader -x "dlsun9999:1521:mydb" scott tiger emp java oracle.xml.transx.loader -s "dlsun9999:1521:mydb" scott tiger emp.xml emp ename job
Table 12-1 shows the command-line parameters.
Parameter | Meaning |
---|---|
connect_string |
JDBC connect string You can omit the connect string information through the '@' symbol. 'jdbc:oracle:thin:@' will be supplied. |
username |
Database user name. |
password |
Password for the database user. |
datasource |
An XML data source. |
option |
Options in Table 12-2, "TransX Utility Command-line Options". |
The following are the command-line option exceptions:
Omitting all arguments will result in the display of the front-end usage information shown in the table.
For complete details of the Java API for TransX Utility:
The following is sample code for the TransX Utility:
String datasrc[] = {"data1.xml", "data2.xml", "data3.xml"}; // instantiate a loader TransX transx = loader.getLoader(); // start a data loading session transx.open( jdbc_con_str, usr, pwd ); // specify operation modes transx.setLoadingMode( LoadingMode.SKIP_DUPLICATES ); transx.setValidationMode( false ); // load the dataset(s) for ( int i = 0 ; i < datasrc.length ; i++ ) { transx.load( datasrc[i] ); } // cleanup transx.close();
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|