Hello,
i'm using xpo to connect to an oracle database and execute some queries. I'm getting this error "OracleConnection does not support parallel transactions".
Here it is the xpo helper for oracle that i'm using
public static class XpoHelperOracle
{
private static string _connectionStringOracle = "XpoProvider=Oracle;Data Source=192.168.0.101/XE;User ID=myuser;Password=mypass
";
public static Session GetNewSession()
{
return new Session(DataLayer);
}
public static UnitOfWork GetNewUnitOfWork()
{
return new UnitOfWork(DataLayer);
}
private readonly static object lockObject = new object();
static IDataLayer fDataLayer;
static IDataLayer DataLayer
{
get
{
if (fDataLayer == null)
{
lock (lockObject)
{
fDataLayer = GetDataLayer();
}
}
return fDataLayer;
}
}
private static IDataLayer GetDataLayer()
{
// set XpoDefault.Session to null to prevent accidental use of XPO default session
// Se commento il session = null, allora non mi funziona il cambio nome colonna per le tabelle intermedie
//XpoDefault.Session = null;
XPDictionary dictionary = new ReflectionDictionary();
// initialize the XPO dictionary
dictionary.GetDataStoreSchema(typeof(Preordine).Assembly);//Basta solo una classe per assembly Q279523
//XpoDefault.ConnectionString = _connectionString;//da errore
IDataStore store = XpoDefault.GetConnectionProvider(_connectionStringOracle, AutoCreateOption.SchemaAlreadyExists);//oracle
// create a ThreadSafeDataLayer
IDataLayer dl = new ThreadSafeDataLayer(dictionary, store);
return dl;
}
}
any idea why this happen? thank you.
Note that i'm using xpo on a aspnet webpage.
Hi Walter,
The helper you are using is quite standard (it is similar to the one provided in the How to use XPO in an ASP.NET (Web) application article). The rest of your situation is unclear. Please provide us with the queries that lead to the error, or a small sample project demonstrating the issue.
Hi,
the situation is unclear to mee too, becuase this error occur rarely. As i have understood the error is shown when a user is executing a query on oracle server and another one attempt at the same time to execute the same query(or another one).
From research i have done over internet, it seems that, the oracle version i'm using does not not support parallel transaction that's why xpo shows me the error. A solution could be to open new connections and execute the query but how to do that?
…how to do that with xpo?
ps: I think 500 char for a comment are not sufficient.
Thank you
This error may occur if a new transaction is started while another transaction is in progress. However, in our code we serialize queries and lock the provider while a query is being processed. Possibly, you are manually managing transactions in an inappropriate manner. Please elaborate more on what you are doing in your application and how. A small sample project reproducing the issue would be helpful.