How to Create an XTS File
XTS or Extract Table Schema can be used to retrieve one, many, or all table schemas from a given database by connecting directly to the database via JDBC to extract the database’s schema.
The extracted schema is saved to an encrypted file. The encrypted file can then be imported into the GenRocket web platform to automatically do the following:
- Import the Application or Database Data Schema.
- GenRocket XTS and Data Warehouse will automatically set up all Domains, Attributes, and assign Generators.
- You will use the Domain Referencing Wizard to establish Parent-Child-Sibling relationships for the Domains.
- You will swap out the Generators that were incorrectly assigned by the Data Warehouse for the correct Generators and modify Generator Parameters.
Prerequisite 1: Connecting to a Database
The GenRocket table schema importer must connect to a database via JDBC. The importer does this by accessing a user’s profile and then reading the configuration file passed in the command line with the -xts option.
Prerequisite 2: JDBC Configuration File
The JDBC configuration file must contain the following four parameters (the order of the parameters does not matter):
- driver – The name of the database driver.
- user – The username to connect to the database.
- password – The password to connect to the database.
- url – The universal resource locator to connect to the database.
The following example configuration file connects to a MySQL database called, acme.
driver=com.mysql.jdbc.Driver
user=root
password=admin
url=jdbc:mysql://localhost:3306/acme
XTS Command Line
The following command line options instruct GenRocket to retrieve one, many, or all table schemas from a given database by connecting directly to the database via JDBC to extract the database’s schema.
The extracted schema is saved to an encrypted file. The encrypted file can then be imported to the GenRocket web application to automatically create Domains for each table whose schema is defined within the encrypted file.
-xts,
–export-table-schema <<pathToJDBCFile> <tableNames>>
Required Parameter
<pathToJDBCFile> – Defines the path and file name of the JDBC Properties file
- Example: /home/jdoe/config/config.properties
Optional Parameter
<tableName> – Defines the names of one or more tables whose schema is to be extracted.
- Example: genrocket -xts /home/jdoe/config/config.properties company,department,user
- If table belongs to a particular schema in your database (e.g. schema1), then your command should include the schema name as well:
-
Example: genrocket -xts
/home/jdoe/config/config.properties schema1:company,schema1:department, schema1:user
- If you want to export all tables of your schema, use <schemaName>:*
- Example: genrocket -xts /home/jdoe/config/config.properties schema1:*
- Importing tables from more than one schema
- Example: genrocket -xts /home/jdoe/config/config.properties schema1:user,schema2:address
Note: By not providing any table names, all table’s schema within the given database will be extracted.
Additional Property for Oracle
For Oracle if you face the following exception in creating the XTS file:
ORA-01000: maximum open cursors exceeded
The Config file needs to have 1 more property.
connection=NEW
This property creates the new Connection to read each table information.
Sequence of Events
The following sequence diagram describes the steps that GenRocket executes once an -xts command is given:
Link:
https://genrocket.freshdesk.com/a/solutions/articles/19000059326
Search GenRocket Knowledge Base
Related Assets
Using GenRocket XTS - Extract Table Schema
XTS stands for Extract Table Schema. In this approach GenRocket can retrieve one
Read More