Connection error in COM+(Oracle;MSDAORA)
Hi,
I've developed a webservice(ASP with COM+(VB6.0)) that has to support both SQL Server as Oracle. I've tested all functionality succesfull with SQL Server(TSQL). However when I try to connect with Oracle I get the following error(in Dutch):
Code:
Error -2147168229 : 19-09-2005 15:00:18
- Description: GetConnection error: 'ORA; Provider=msdaora;Data Source=demo;User Id=demonl93;Password=demonl93; Kan geen verbinding maken met transactiebeheer, of transactiebeheer
is niet beschikbaar.'
- Line Number: 46
The error in English: "Can't connect to transactionmanagement, or ..." :ehh:
The lines above are from a self-written log-function. Underneath the vbcode that retrieves the connectionstring from a user defined registrysetting.
VB Code:
Public Sub GetConnection(ByRef cnCon As ADODB.Connection)
On Error GoTo GetConnection_ERR
'get database type and connection string from the registry.
10 strConnType = GetRegistrySetting("DBTYPE")
20 strConString = GetRegistrySetting("constring")
'ensure objCon holds a reference to a connection object
If cnCon Is Nothing Then
30 Set cnCon = New ADODB.Connection
End If
With cnCon
40 .ConnectionString = strConString
42 .ConnectionTimeout = 10
44 .CursorLocation = adUseClient
46 .Open
End With
Exit Sub
GetConnection_ERR:
'log the error
logError Err.Number, "GetConnection error: '" & strConnType & "; " & strConString & "; " & Err.Description & "'", Erl()
End Sub
VB Code:
Public Function GetRegistrySetting(ByVal strKeyValue As String) As String
On Error GoTo GetRegistrySetting_ERR
Dim lngKeyRoot As Long
Dim strKeyName As String
Dim lngRetVal As Long '// result of the API functions
Dim lngKey As Long '// handle of opened key
Dim vntValue As Variant '// setting of queried value
10 lngKeyRoot = HKEY_LOCAL_MACHINE
20 strKeyName = FMWEBSERVICE_REGISTRY_KEYNAME
30 lngRetVal = RegOpenKeyEx(lngKeyRoot, strKeyName, 0, KEY_READ, lngKey)
40 lngRetVal = QueryValueEx(lngKey, strKeyValue, vntValue)
50 RegCloseKey (lngKey)
60 GetRegistrySetting = vntValue
Exit Function
GetRegistrySetting_ERR:
'log the error
logError Err.Number, "GetRegistrySetting: '" & Err.Description & "'", Erl()
End Function
This is how the registry settings look like:
Constring: Provider=msdaora;Data Source=demo;User Id=demonl93;Password=demonl93
Dbtype: ORA
Hopefully someone can help me? :(
Tnx! ;)
Re: Connection error in COM+(Oracle;MSDAORA)
Do you have the proper entry in your TNSNames.ora file?
Re: Connection error in COM+(Oracle;MSDAORA)
The tnsnames.ora file has to be correct, because I can connect with SQL+ to the database listed in the registry. I Have also a CMS for this webservice which doesn't use COM+(VB-code listed in this thread) and that just works perfectly. :ehh:
Is there perhaps a setting in the Component Services of Windows that maybe has to be modified or can I change a transaction setting within my VB-code? :confused:
Grtz.
Re: Connection error in COM+(Oracle;MSDAORA)
I've adjusted some settings in Visual Basic(v6) that seem to resolve the problem.
The error only occured on objects where I setted the property "MyTransactionMode" as "2 - RequiresTransaction". I found out that changing this setting to "3 - UsesTransaction" solved the error.
Can anybody tell me what the exact consequence of this change is? Who knows if the problem in the first situation("2 - RequiresTransaction") can be solved? :confused:
tnx! ;)