AMT Help Files
homeAMT Developer StudioCode ManagementLionRepository ModuleClass LionRepository

Class LionRepository

Before the module can be used in code, an object of the class LionRepository needs to 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 Enum The database type MsSql/Oracle/Db2 of the repository.
For possible values, see the LionDatabaseType enumeration below.
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
  • Unknown = 0
  • MsSql = 1
  • Oracle = 2
  • Db2 = 3

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"

}

Contents

 Go to top