Ihave read the accepted answer to this post: ExecuteReader requires an open and available Connection. The connection's current state is Connecting
I have a few connection strings that are stored in a database table. I was thinking about doing something like this:
Public class classConnection
private con1 As dbConnection
private strConnectionString As String
private intType As Integer
Public Sub New()
con1 = New SQLConnection({connectionstring})
End Sub
Public Sub getConnectionStringByDescription()
'Connect to con1 and get connection string
'Set the connection string property
'Set the database type e.g. Oracle
End Sub
Public Sub getConnectionStringByStatus()
'Connect to con1 and get connection string
'Set the database type e.g. Oracle
End Sub
Public Function getConnection() As dbConnection
If intType=1 Then
return New SQLConnection(strConnectionString)
ElseIf intType=2 Then
return New OracleConnection(strConnectionString)
End If
End Function
I am wandering if this will cause problems with the connection pool mechanism as I am effectively encapsulating some of the logic in a class for connecting to these databases.