Database: decrypt connection string in Get_ConnectionStringforID
This commit is contained in:
parent
c30ed9d4da
commit
0ef88b919e
@ -141,12 +141,17 @@ Public Class MSSQLServer
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Function GetConnectionStringForId(pConnectionId As Integer) As String
|
||||
Return Get_ConnectionStringforID(pConnectionId)
|
||||
End Function
|
||||
|
||||
Public Function Get_ConnectionStringforID(pConnectionId As Integer) As String
|
||||
Dim connectionString As String = ""
|
||||
Dim oConnectionString As String = ""
|
||||
|
||||
Try
|
||||
Dim oDTConnection As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
|
||||
If oDTConnection.Rows.Count = 1 Then
|
||||
Dim oRow As DataRow = oDTConnection.Rows(0)
|
||||
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")
|
||||
@ -156,28 +161,33 @@ Public Class MSSQLServer
|
||||
Select Case oProvider
|
||||
Case "MS-SQL"
|
||||
If oUser = "WINAUTH" Then
|
||||
connectionString = $"Server={oServer};Database={oDatabase};Trusted_Connection=True;"
|
||||
oConnectionString = $"Server={oServer};Database={oDatabase};Trusted_Connection=True;"
|
||||
Else
|
||||
connectionString = $"Server={oServer};Database={oDatabase};User Id={oUser};Password={oPassword};"
|
||||
oConnectionString = $"Server={oServer};Database={oDatabase};User Id={oUser};Password={oPassword};"
|
||||
End If
|
||||
Case "Oracle"
|
||||
|
||||
Case "ORACLE"
|
||||
If oRow.Item("BEMERKUNG").ToString.Contains("without tnsnames") Then
|
||||
connectionString = $"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={oServer})(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={oDatabase})));User Id={oUser};Password={oPassword};"
|
||||
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
|
||||
connectionString = $"Data Source={oServer};Persist Security Info=True;User Id={oUser};Password={oPassword};Unicode=True"
|
||||
oConnectionString = $"Data Source={oServer};Persist Security Info=True;User Id={oUser};Password={oPassword};Unicode=True"
|
||||
End If
|
||||
|
||||
Case Else
|
||||
_Logger.Warn("Provider {0} nicht unterstützt!", oProvider)
|
||||
|
||||
End Select
|
||||
|
||||
Else
|
||||
_Logger.Info("No entry for Connection-ID: " & pConnectionId.ToString)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Info("Error in bei Get_ConnectionStringforID")
|
||||
End Try
|
||||
Return connectionString
|
||||
|
||||
Return DecryptConnectionString(oConnectionString)
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user