Creating a sample schema in a database
To generate a schema in HCL® OneTest™ Data, you must create a schema with a table in the database.
About this task
- HIP Server is responsible to establish a connection with the JDBC-supported database. This pod also generates a schema by using the tables of the database. The structure of a schema is a flat hierarchy, where all the item types are in a single group called a Row. The item types in a schema refer to the columns of the table.
- HIP REST is responsible to run the map and generate the data. This pod also writes the generated data to the JDBC-supported database.
Both the pods use the connector jar file to communicate with the JDBC-supported database.
Connector jar | Location |
---|---|
Mysql Server connector jar | https://dev.mysql.com/downloads/connector/j/ |
Microsoft SQL Server connector jar | https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15 |
IBM DB2 | https://www.ibm.com/support/pages/db2-jdbc-driver-versions-and-downloads |
Procedure
-
Download the JDBC-supported database connector jar file to your local file
system.
Note: You must download the connector jar file that is compatible with the database server.
-
Copy the connector jar file from your local file system to the pods by using
the following commands from the command prompt.
For example, run the following commands if you are using the MySQL database:
For HIP REST
kubectl cp /<source path>/mysql-connector-java-8.0.19.jar {my-ots}-<hip rest podname>:/opt/runtime/extjar/mysql-connector-java-8.0.19.jar -n test-system
For HIP Server
kubectl cp /<source path>/mysql-connector-java-8.0.19.jar {my-ots}-<hip server podname>:/opt/hcl/hip/extjar/mysql-connector-java-8.0.19.jar -n test-system
Notes:- Depending on the database you use, you must copy different connector jar files to the pods.
- While copying the jar files to the pods, you must ensure that the
names of pods are same as those installed on HCL OneTest™ Server.
For example:
- HIP Rest is displayed as
{my-ots}-hip-rest-6757c99d9-4qjtl
- HIP Server is displayed as
{my-ots}-hip-server-0
- HIP Rest is displayed as
- When you install or restore HCL® OneTest™ Data, you must copy the connector jars files again.
-
Create a schema with a table in the database by using the following commands
from the command prompt.
For example, you can use the following command to create a table in a schema:
create schema <schema_name>; use <schema_name>; CREATE TABLE IF NOT EXISTS <table_name> ( Column1 <DataType> Constraint, Column2 <DataType> Constraint, Column2 <DataType> Constraint,,,,,, );
Remember: In HCL® OneTest™ Data, you must refer to the schema name and the table name that you created by using this command.
Results
You have created a sample schema with a table in the database.
What to do next
After you create a schema in the database, you must establish the connection between HCL® OneTest™ Data and the JDBC-supported database. See Establishing a JDBC connection with HCL OneTest Data.
You can view the schema name that you created in the database as the value of the Catalog or Schema property in HCL® OneTest™ Data.