Commit vor Firebird entfernen

This commit is contained in:
Developer01
2026-01-23 12:08:49 +01:00
parent a4dc5c5cd3
commit 1b7c7814bc
3 changed files with 58 additions and 12 deletions

View File

@@ -75,7 +75,7 @@ Public Class MSSQLServer
''' <summary>
''' Decrypts a connection string password.
''' </summary>
''' <param name="pConnectionString">A connection string with a encrypted password</param>
''' <param name="pConnectionString">A connection string with an encrypted password</param>
''' <returns>The connection string with the password decrypted.</returns>
<DebuggerStepThrough()>
Public Shared Function DecryptConnectionString(pConnectionString As String) As String
@@ -87,6 +87,11 @@ Public Class MSSQLServer
Return oBuilder.ToString()
End Function
<DebuggerStepThrough()>
Private Function IDatabase_DecryptConnectionString(pConnectionString As String) As String Implements IDatabase.DecryptConnectionString
Return DecryptConnectionString(pConnectionString)
End Function
<DebuggerStepThrough()>
Public Function GetConnectionString(Server As String, Database As String, UserId As String, Password As String) As String
Dim oConnectionStringBuilder As New SqlConnectionStringBuilder() With {
@@ -146,7 +151,7 @@ Public Class MSSQLServer
End Select
End Function
Public Function GetConnectionStringForId(pConnectionId As Integer) As String
Public Function GetConnectionStringForId(pConnectionId As Integer) As String Implements IDatabase.GetConnectionStringForId
Return Get_ConnectionStringforID(pConnectionId)
End Function
Public Function GetGDPictureString() As String
@@ -194,14 +199,6 @@ Public Class MSSQLServer
Else
oConnectionString = $"Server={oServer};Database={oDatabase};User Id={oUser};Password={oPassword};"
End If
Case "ORACLE"
If oRow.Item("BEMERKUNG").ToString.Contains("without tnsnames") Then
oConnectionString = $"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={oServer})(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={oDatabase})));User Id={oUser};Password={oPassword};"
Else
oConnectionString = $"Data Source={oServer};Persist Security Info=True;User Id={oUser};Password={oPassword};Unicode=True"
End If
Case Else
Logger.Warn("Provider [{0}] not supported!", oProvider)
@@ -213,7 +210,7 @@ Public Class MSSQLServer
Catch ex As Exception
Logger.Error(ex)
Logger.Warn("Error in Get_ConnectionStringforID")
Logger.Warn("Error in Get_ConnectionStringforID (MSSQLServer.VB)")
End Try
Return DecryptConnectionString(oConnectionString)

View File

@@ -10,7 +10,53 @@ Public Class Oracle
Private ReadOnly _Timeout As Integer
Private ReadOnly _Logger As Logger
Public Function GetConnectionStringForId(pConnectionId As Integer) As String Implements IDatabase.GetConnectionStringForId
Return Get_ConnectionStringforID(pConnectionId)
End Function
Public Function Get_ConnectionStringforID(pConnectionId As Integer) As String
Dim oConnectionString As String = String.Empty
_Logger.Debug("Getting ConnectionString for ConnectionId [{0}]", pConnectionId)
If pConnectionId = 0 Then
_Logger.Warn("ConnectionId was 0. Falling back to default connection.")
Return String.Empty
End If
Try
Dim oTable As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
If oTable.Rows.Count = 1 Then
Dim oRow As DataRow = oTable.Rows(0)
Dim oProvider = oRow.Item("SQL_PROVIDER").ToString.ToUpper
Dim oServer = oRow.Item("SERVER")
Dim oDatabase = oRow.Item("DATENBANK")
Dim oUser = oRow.Item("USERNAME")
Dim oPassword = oRow.Item("PASSWORD")
Select Case oProvider
Case "ORACLE"
If oRow.Item("BEMERKUNG").ToString.Contains("without tnsnames") Then
oConnectionString = $"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={oServer})(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={oDatabase})));User Id={oUser};Password={oPassword};"
Else
oConnectionString = $"Data Source={oServer};Persist Security Info=True;User Id={oUser};Password={oPassword};Unicode=True"
End If
Case Else
_Logger.Warn("Provider [{0}] not supported!", oProvider)
End Select
Else
_Logger.Warn("No entry for Connection-ID: [{0}] ", pConnectionId.ToString)
End If
Catch ex As Exception
_Logger.Error(ex)
_Logger.Warn("Error in Get_ConnectionStringforID (Oracle.VB)")
End Try
Return DecryptConnectionString(oConnectionString)
End Function
Public Sub New(LogConfig As LogConfig, ConnectionString As String, Optional Timeout As Integer = 120)
_Timeout = Timeout
_Logger = LogConfig.GetLogger()
@@ -66,7 +112,7 @@ Public Class Oracle
''' <param name="ConnectionString">A connection string with a encrypted password</param>
''' <returns>The connection string with the password decrypted.</returns>
<DebuggerStepThrough()>
Public Shared Function DecryptConnectionString(ConnectionString As String) As String
Public Function DecryptConnectionString(ConnectionString As String) As String Implements IDatabase.DecryptConnectionString
Dim oEncryption As New EncryptionLegacy()
Dim oBuilder As New OracleConnectionStringBuilder() With {.ConnectionString = ConnectionString}
Dim oDecryptedPassword = oEncryption.DecryptData(oBuilder.Password)