7. Examples of running Connect XML-2-DB as
a standalone program
This section provides a complete example of running Connect XML-2-DB as
a standalone program for both Oracle and SQL Server. It includes some
scripts to create the database tables, mapping files, sample XML data
files and sample configuration files. To run this example modify the configuration
file to point to your database system, run the scripts to create the database
tables, modify the mapping file to point to your appropriate schema/database,
and then run the Connect XML-2-DB tool.
Oracle example of running Connect XML-2-DB
as a standalone program
For Oracle, the example files are in the directory examples\oracle_exs.
The files included are:
|
oracle_conn_config.txt |
|
Database connection information file. |
|
O_create_tables_customers_sales.sql |
|
Script for creating the database tables and sequences. |
|
O_customer_sales.xml |
|
XML data file, whose data has to be inserted into the
database. |
|
O_customer_sales_map.xml |
|
Mapping file which determines into which tables and
columns the data has to be inserted. |
|
O_runStandalone.bat |
|
This is the batch file to run Connect XML-2-DB |
Step 1: Edit the database connection configuration
files
Edit the database connection configuration file - oracle_conn_config.txt.
Replace MACHINENAME, DBNAME, TESTUSER and TESTUSERPASSWORD with the machinename,
database name, login id and login password in this file.
Step 2: Create the tables and sequences
Create the tables and sequences in the script O_create_tables_customers_sales.sql
in the schema that you specified as the login id (TESTUSER) in the configuration
file, oracle_conn_config.txt.
Step 3: Edit the mapping file O_customer_sales_map.xml
In this file there are XML elements, table-reference-information and sequence-reference-information
elements that have the attribute object-owner="TESTUSER". Replace
"TESTUSER" with the schema that you created the tables and sequences
in.
Step 4: Edit the batch file, runXmlToDb.bat, for
running Connect XML-2-DB
In this file, set the value of XML2DB_ROOT to point to the directory in
which Connect XML-2-DB has been installed. For example,
set XML2DB_ROOT=C:\xml2db_ver_1_0
Set the value of JDKROOT to the directory in which the Java JDK has been
installed. For example,
set JDKROOT=C:\j2sdk1.4.1_02
Step 5: Run Connect XML-2-DB
Run the batch file O_runStandalone.bat from the command prompt.
SQL Server example
of running Connect XML-2-DB as a standalone program
For SQL Serever, the example files are in the directory examples\sqlserver_exs.
The files included are:
|
sqlserver_conn_config.txt |
|
Database connection information file. |
|
S_create_tables_customers_sales.sql |
|
Script for creating the database tables and sequences. |
|
S_customer_sales.xml |
|
XML data file, whose data has to be inserted into the
database. |
|
S_customer_sales_map.xml |
|
Mapping file which determines into which tables and
columns the data has to be inserted. |
|
S_runStandalone.bat |
|
This is the batch file to run Connect XML-2-DB |
Step 1: Edit the database connection configuration
files
Edit the database connection configuration file - sqlserver_conn_config.txt.
Replace MACHINENAME, DBNAME, TESTUSER and TESTUSERPASSWORD with the machinename,
database name, login id and login password in this file.
Step 2: Create the tables in the appropriate database
Create the tables in the script S_create_tables_customers_sales.sql in
the same database DBNAME, and under the same owner TESTUSER, that you
specified in the configuration file, sqlserver_conn_config.txt.
Step 3: Edit the mapping file S_customer_sales_map.xml
In this file there are table-reference-information elements that have
the attributes object-owner="TESTUSER" and database-name="DBNAME".
Replace "TESTUSER" with the schema that you created the tables
and sequences in. Replace "DBNAME" with the database name that
you used for creating the tables in Step 2.
Step 4: Edit the batch file, runXmlToDb.bat, for
running Connect XML-2-DB
In this file, set the value of XML2DB_ROOT to point to the directory in
which Connect XML-2-DB has been installed. For example,
set XML2DB_ROOT=C:\xml2db_ver_1_0
Set the value of JDKROOT to the directory in which the Java JDK has been
installed. For example,
set JDKROOT=C:\j2sdk1.4.1_02
Step 5: Run Connect XML-2-DB
Run the batch file S_runStandalone.bat from the command prompt. |