This commit is contained in:
Digital Data - Marlon Schreiber
2019-01-23 18:01:24 +01:00
parent 6c9fc1c9e6
commit 00924416ec
5 changed files with 60 additions and 32 deletions

View File

@@ -85,35 +85,35 @@ Public Class Firebird
''' <param name="Password"></param>
''' <exception cref="Exceptions.DatabaseException"></exception>
Public Sub New(LogConfig As LogConfig, Datasource As String, Database As String, User As String, Password As String)
Try
_MyLogger = LogConfig
_Logger = _MyLogger.GetLogger()
Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password)
_MyLogger = LogConfig
_Logger = _MyLogger.GetLogger()
_connectionServer = Datasource
_connectionDatabase = Database
_connectionUsername = User
_connectionPassword = Password
_connectionString = oConnectionString
_Logger.Debug("Connecting to database..")
' Test the connection
Dim oConnection = GetConnection()
' If initial connection was successfully, close it
oConnection.Close()
If oConnection Is Nothing Then
Throw New Exceptions.DatabaseException()
Else
_DBInitialized = True
End If
Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password)
_Logger.Debug("Connection sucessfully established!")
Catch ex As Exception
_Logger.Error(ex)
End Try
_connectionServer = Datasource
_connectionDatabase = Database
_connectionUsername = User
_connectionPassword = Password
_connectionString = oConnectionString
_logger.Debug("Connecting to database..")
' Test the connection
Dim oConnection = GetConnection()
' If initial connection was successfully, close it
oConnection?.Close()
If oConnection Is Nothing Then
Throw New Exceptions.DatabaseException()
Else
_DBInitialized = True
End If
_logger.Debug("Connection sucessfully established!")
End Sub
Public Function GetConnection() As FbConnection