I'm using a combination of Dapper and Quartz.Net to save information for a calendar object to an 11gR2 database (Quartz is self contained, the Dapper call is calling a procedure).
I'm using the Microsoft sanctioned method of TransactionScope to initiate a transaction and have connections set to automatically enlist in a distributed transaction if one is already running.
I'm using the Managed Oracle driver so haven't got a 12c client installed
Here's what's odd. The first connection always opens successfully and gets enlisted to the transaction, whichever way round I do it.
The second always fails, and throws an ORA-12514 error.
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12514: TNS:listener does not currently know of service requested in connect descriptor ---> OracleInternal.Network.NetworkException (0x000030E2): ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
at OracleInternal.Network.OracleCommunication.DoConnect(String tnsDescriptor)
at OracleInternal.Network.OracleCommunication.Connect(String tnsDescriptor, Boolean externalAuth, String instanceName)
at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession, String instanceName)
at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.PoolManager`3.GetEnlisted(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp)
at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
I doubt this is a problem with the underlying connectivity, because if I remove the transaction scope and just run the save operation as two individual calls, everything works fine.
The below is a rudimentary example of what I'm doing, trimmed down and anonymised.
<snip>
using(var tx = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions {IsolationLevel = isolationLevel}) {
_connection.Open(); // works, BUT if I move this line under the next one, the calendar save will succeed and this will fail.
quartzScheduler.AddCalendar(calendar.Name, c1, true, true); // calls underlying Quartz class that opens a connection and saves to the db - this line will fail
_repository.Save(_connection);
}
</snip>
MS DTC service is running, Oracle MTS Recovery service (for 11 client) is installed and also running.
I am running out of ideas, the help in this area seems rather sparse once you go outside of saving to one specific schema and db.
It looks like I may also need a Oracle MTS service installed but not sure where to get this now that 12c doesn't have a client install any longer.
Any ideas?