Class LionRepository
Before the module can be used in the code an object of the class LionRepository has te be created using the class constructor. When the object has been created the function shown below is available for opening a connection to the repository which creates an ILionRepository object. This object allows further access to the repository.
Function
Function name | Return type |
Parameters |
Description | |
Name |
Type |
|||
OpenConnection | ILionRepository Object | Opens a database connection to the specified repository, returns Lion repository interface. | ||
DatabaseType | LionDatabaseType Object | The database type MsSql/Oracle/Db2 of the repository. | ||
ServerName | String | Database server name. | ||
UserCode | String | Usercode to connect with. | ||
Password | String | Password to use on the connect. | ||
DbsName | String | For MsSql the database to select with a USE. | ||
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 | Use Integrated Security for the database connection. Default is false. |
Enumerations
Name | Type | Enumeration |
LionDatabaseType | Integer |
|
Example
C#
ILionRepository repos = new LionRepository(); repos = repos.OpenConnection(LionDatabaseType.Oracle, "OracleServer1", "user", "password", "REPOSLION", "REPOSSCHEMA", false, "ExampleProgram"); |
PowerShell
$O_Module = New-Object Asysco.Lion.Repository.Model.LionRepository $O_Repos = $O_Module.OpenConnection(1, "VMDB-MSSQL2016\MSSQL2016", "user", "password", "REPOSLION", "", $false, "ExampleProgram") # Connection attempt example try { $O_Repos.OpenConnection(1, "VMDB-MSSQL2016\MSSQL2016", "user", "password", "REPOSLION", "", $false, "ExampleProgram") } catch [Asysco.Amt.Libs.Support.AmtException] { "This is probably an empty database" } |