Before the module can be used in code, create an object of the LionRepository class by using the class constructor. After the object is created, the function shown below is available to open a connection to the repository and return an ILionRepository object. This object provides further access to the repository.
| Function name | Return type | Parameters | Description | |
|---|---|---|---|---|
| Name | Type | |||
| OpenConnection | ILionRepository object | Opens a database connection to the specified repository and returns the Lion repository interface. | ||
| DatabaseType | LionDatabaseType enum | The database type of the repository, such as MsSql, Oracle, or Db2. For valid values, see the LionDatabaseType enumeration below. |
||
| ServerName | String | Database server name. | ||
| UserCode | String | User code used to connect. | ||
| Password | String | Password used for the connection. | ||
| DbsName | String | For Microsoft SQL Server, the database to select by using a USE statement. | ||
| Schema | String | For Oracle, the schema name to use in the repository. | ||
| UseSSLConnection | Boolean | Use an SSL/TLS connection. | ||
| ProgramName | String | Name of the application, used in the database connection string. | ||
| IntegratedSecurity (optional) |
Boolean | Uses integrated security for the database connection. Default is false. | ||
| Name | Type | Enumeration |
|---|---|---|
| LionDatabaseType | Integer |
|
ILionRepository repos = new LionRepository();
repos = repos.OpenConnection(LionDatabaseType.Oracle, "OracleServer1", "user", "password", "REPOSLION", "REPOSSCHEMA", false, "ExampleProgram");$O_Module = New-Object Asysco.Lion.Repository.Model.LionRepository
$O_Repos = $O_Module.OpenConnection(1, "VMDB-MSSQL2025\MSSQL2025", "user", "password", "REPOSLION", "", $false, "ExampleProgram")
# Connection attempt example
try {
$O_Repos.OpenConnection(1, "VMDB-MSSQL2025\MSSQL2025", "user", "password", "REPOSLION", "", $false, "ExampleProgram")
} catch [Asysco.Amt.Libs.Support.AmtException] {
"This is probably an empty database"
}