Setting up the schema used for stubbing a physical database

Before you can create database stubs, you must specify in HCL OneTest API which database schema is to be used for the simulation database.

About this task

If you are using HCL OneTest API 8.5.0 or later and you want to simulate an IBM IBM® Db2®, Oracle, Microsoft SQL Server, or MySQL database, you can use the integrated simulation database or a vendor-specific database. If you want to use the vendor-specific database, your database administrator (DBA) first needs to create a separate schema for the stub data. The schema must match the corresponding database. For example, to stub an Oracle database, you need an Oracle schema. Alternatively, to stub a Microsoft SQL Server database, you need a Microsoft SQL Server schema, and so on.

The integrated simulation database is an Apache Derby database that is included with HCL OneTest API. Although the Apache Derby database is based on the Java, JDBC, and SQL standards, it cannot simulate the characteristics of all other databases. Therefore, SQL statements for unsupported databases will fail on an Apache Derby database. Hence, in the following situations, you must use a database of the same type as the original simulation database:
  • An application may be using SQL syntax that is not understood by the integrated simulation database. This will be evident if the console of the application displays messages about unexpected JDBC exceptions during the recording (learning) phase. If you are using the HCL OneTest API JDBC proxy, these SQL errors are also logged in the activity log of HCL® Quality Server, which is viewable if you have HCL® Quality Server administrator privileges.
  • A database might support a data type that the integrated simulation database does not support. This will be evident if you try to edit a database table of a database stub that includes a data type not supported by the Apache Derby database. HCL OneTest API will display SQL syntax error messages when saving the database table.
Note: If you elect to use the integrated simulation database, the instances of the databases that Apache Derby uses are stored in the workspace of HCL OneTest API or its Agent, whichever is applicable. The specific location in the workspace is unimportant because the locations where the instances are stored are transient.
Depending on the option you select, the database schema or the integrated simulation database will be used in the following cases:
  • While HCL OneTest API is "learning" the stubs
  • When a stub is started, that is, the database schema or the integrated database will be used to store the contents of a database stub
To grant the required permissions while using an Oracle database for simulations that need JDBC, run the following SQL code:
grant CREATE SESSION, ALTER SESSION, -
CREATE PROCEDURE, -
CREATE SEQUENCE, CREATE SYNONYM, CREATE TABLE, -
CREATE TYPE, UNLIMITED TABLESPACE -
to VIRT_USER;

The following table lists the live and simulation database combinations that are supported by different versions of HCL OneTest API.

Live and simulation database combination support HCL OneTest API version
Db2®/Db2® All
Db2®/Integrated simulation database (excluding support for JDBC virtualization on IBM® WebSphere® Application Server) 8.5.0 or later
Db2®/Integrated simulation database (including support for JDBC virtualization on WebSphere® Application Server) 8.5.1 or later
Microsoft SQL Server/Microsoft SQL Server All
Microsoft SQL Server/Integrated simulation database (excluding support for JDBC virtualization on WebSphere® Application Server) 8.5.0 or later
Microsoft SQL Server/Integrated simulation database (including support for JDBC virtualization on WebSphere® Application Server) 8.5.1 or later
MySQL/MySQL All
MySQL/Integrated simulation database (excluding support for JDBC virtualization on WebSphere® Application Server) 8.5.0 or later
MySQL/Integrated simulation database (including support for JDBC virtualization on WebSphere® Application Server) 8.5.1 or later
Oracle/Oracle All
Oracle/Integrated simulation database (excluding support for JDBC virtualization on WebSphere® Application Server) 8.5.0 or later
Oracle/Integrated simulation database (including support for JDBC virtualization on WebSphere® Application Server) 8.5.1 or later

Procedure

  1. In the Physical View of the Architecture School perspective of HCL OneTest API, double-click the physical database that you want to stub.
  2. Click the Stub Settings tab.
    Note: If you are using HCL OneTest API 8.5.0 or later, by default, the Use integrated database check box is selected.
  3. Specify the database to use.
    • To proceed with the integrated simulation database, click OK to close the window.
    • To use a vendor-specific database, clear the Use integrated database check box and complete the remaining steps in this procedure.
  4. In the Database URL field, enter the URL of the server that will host the database stub schema. For more information on specification of Database URLs when using IP literal addresses, see IP literal address.
  5. In the User Name field, enter the name of the relevant database user.
  6. In the Password field, enter the database users password.
  7. In the Database Schema field, enter the name of the database stub schema.
    Note: HCL OneTest API manages the content of the simulation database, including dropping and creating content when database stubs are executed. To avoid collisions between this management of the simulation database and the content of the live database, the database settings for the live and simulation databases must be distinct. The combination of database URL and schema must provide sufficient separation between the live database and the simulation database; for example, you could use different schemas within the same database or you could use completely different database instances.
    Note: The user name, password, and schema name should be provided by a database administrator (DBA). The database user must also have sufficient privileges to be able to create and delete tables in the simulation database.
  8. Optional: When working with database virtualization, if you observe that the data in the simulation database is not reset automatically, use the Clear simulation database option to manually clear the data.
  • Modify the default value of the Max Row Count field. The default value of the field is 10,000. You can decrease this default value to limit the maximum number of rows copied when learning from a live database or when copying rows into a database stub.
  • Modify the default value of the Max Stored Procedure Calls field. The default value of the field is 10,000. If the system under test is very active, you can decrease the value of this field, thus limiting the quantity of data captured by HCL OneTest API while learning.
  • Modify the default value of the Max Result Set Row Count field. The default value of the field is 10,000. You can decrease this default value to limit the maximum number of rows copied when learning a result set returned from a stored procedure and thus limit the amount of information that HCL OneTest API will learn while creating a new database stub. You might want to use this field if you cannot or do not want to modify the behavior of the system under test.

    Limitation: If the result set returned by a stored procedure is scroll-sensitive and dynamic, then the JDBC virtualization cannot learn the stored procedure call.

  • Click the Unique option radio button (default) if you want to record only unique invocations of a stored procedure based on the input parameters. Alternatively, click the All option radio button to record all invocations of a stored procedure.
  1. Click Test Stub Connection to verify the HCL OneTest API connection to the database stub.
  2. Click OK.

Results

You are now ready to create database stubs.