ol test connection

Provide connector connection properties and test connectivity to the datasource

The ol test connection command confirms that the CLI can adequately contact the remote data source by pinging the destination service, receiving a response, and printing the success status.

The command accepts the connection properties of the remote data source. If the connection attempt succeeds, the connection properties and their values are written to module.json under the profiles key.

The module.json file populated with connection properties:

{
  "id" : "50943f0f-6af4-4276-89b8-aba745f63a3b",
  "moduleName" : "as400-new",
  "connectorName" : "as400-cobol",
  "connectorVersion" : "1.35.0",
  "profiles" : {
    "ol_profile" : {
      "host" : "as400.openlegacy.com",
      "user" : "OPENLEGA1",
      "password" : "'{cipher}32aae59a6050eb6995fa2ef4c5ec27a49b0ef0222dceb059ba$
    }
  },
  "type" : "as400Rpc",
  "dtVersion" : "1.35.0"
}

Rules

  • Login to the OL Hub.
  • Execute the ol test connection command from the module root folder.

Syntax

ol test connection [OPTIONS]

Options

Dynamic connection properties (required)

Connection properties determine the connection parameters to the module's remote data source. Each data source type has different connection properties. For example, an SAP data source has different connection properties than a REST data source. 

To learn what are the connection properties for each data source, refer to the ol add command --help option.

Testing the connection to a remote SAP backend service

temp> ol test connection --host 1.1.1.1 --client 800
temp$ ol test connection --host 1.1.1.1 --client 800

Testing the connection to a remote mainframe backend service

temp> ol test-connection --baseUrl http://192.86.32.142 --port 12345 --uriMap oldist3 --codePage CP037
temp$ ol test-connection --baseUrl http://192.86.32.142 --port 12345 --uriMap oldist3 --codePage CP037

--profile

What is a connection profile

A connection profile groups the module's connection properties under a single name. You can create several profiles for the same module to satisfy particular use cases. 

Creating a connection profile

[module-name]> ol test connection --profile dev --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37
[module-name]$ ol test connection --profile dev --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37

A Connection profile enables you to conveniently reuse connection property groups in different ol add and ol test connection runs. 

Using a connection profile

[module-name]> ol test connection --profile dev
[module-name]$ ol test connection --profile dev

❗️

You can define multiple profiles for the same module. For example, you can define one connection profile under the name "dev" that includes the connection properties for the development environment and another under the name "prod" that works with the production environment.

The default connection profile

A module is created with a default empy connection profile that gets automatically updated with connection properties when ol test connection or ol add are executed.

If you want to create a new profile with different connection properties than the default profile, specify only existing properties with different values or new properties. The new profile spans the overridden properties and the new properties. 

When you run ol test connection or ol add with the new profile, the default profile connection properties that are not part of the new profile will be appended to the new and overridden properties. 

Setting the default connection profile

temp> ol test connection --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37
temp$ ol test connection --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37

After the default profile is set, you can use it in a short form of ol test connection or ol add.

Running ol test connection with default profile

[module-name]> ol test connection
[module-name]$ ol test connection

If you want to create a new profile with different connection properties than the default profile, specify only the different properties.

Creating a new profile based on the default profile

[module-name]> ol test connection --password OPENLEGA2 --profile prod
[module-name]$ ol test connection --password OPENLEGA2 --profile prod