Set Isolation level to DIRTY READ in Entity Framework with Informix - entity-framework-5

Is there a way to set isolation levels in Entity Framework 5 with Informix database or LOCK MODE TO WAIT?
I have tried to set isolation using SQL query, at the time of DbContext object creation.
var dataContext = new DatabaseNameContext();
dataContext.Database.ExecuteSqlCommand("SET ISOLATION TO DIRTY READ");
But it seems this is not working. I am still getting a lock exception:
IBM.Data.DB2.DB2Exception (0x80004005): ERROR [IX000] [IBM][IDS/UNIX64]
Could not do a physical-order read to fetch next row.
(-107 ISAM error: record is locked.
I tried using TransactionScope with System.Transactions.IsolationLevel.ReadUncommitted, but it is throwing the exception:
IBM.Data.DB2.DB2Exception (0x80004005): ERROR [58005] [IBM][IDS/UNIX64]
SQL0998N Error occurred during transaction or heuristic processing.
Reason Code = "16". Subcode = "2-8004D026".
Can you explain what's going wrong and how to fix it?

dataContext.Database.ExecuteSqlCommand("SET LOCK MODE TO WAIT 20");
It works for me :) Might be of use to someone...

Related

error in cassandra-driver RequestHandler.getDecision on timeout

uncaughtException: Cannot read property 'consistency' of null, TypeError: Cannot read property 'consistency' of null
at RequestHandler.getDecision (/mnt/infibond/infi-version2/node_modules/cassandra-driver/lib/request-handler.js:351:69)
at RequestHandler.handleError (/mnt/infibond/infi-version2/node_modules/cassandra-driver/lib/request-handler.js:304:27)
at /mnt/infibond/infi-version2/node_modules/cassandra-driver/lib/request-handler.js:285:19
at next (/mnt/infibond/infi-version2/node_modules/cassandra-driver/lib/utils.js:442:14)
at EventEmitter. (/mnt/infibond/infi-version2/node_modules/cassandra-driver/lib/request-handler.js:281:7)
I'm getting this exception in specific cases when i have a timeout (from what i can see in the driver the this.request is null.)
did anyone fix this localy or knows what could have made this error happen?
thanks!
The ticket you submitted looks like a driver bug: https://datastax-oss.atlassian.net/browse/NODEJS-296
It occurs when the Cassandra host is not responsive while preparing a query, which should not occur often as a query gets prepared once in the driver Client instance lifetime.
We've included it for the next patch release (v3.1.2).

DB2 runstats throws exception " The utility could not generate statistics. Error "-911" was returned.. SQLCODE=-2310, SQLSTATE= , DRIVER=3.53.71"

Getting the below error when i run the following command :
call admin_cmd('runstats on TABLE schema.table with distribution and detailed indexes all')
DB2 runstats throws exception " The utility could not generate statistics. Error "-911" was returned.. SQLCODE=-2310, SQLSTATE= , DRIVER=3.53.71"
DB2 version - 9070900, table has 477125 rows. Marked as non-volatile.
Any help would be very much appreciated.
Still waiting on the feedback regarding diagnostics, but from the error it seems like this is related to the table or an index being blocked due to other locks (deadlock or contention).
The db2diag.log should hold information on which other process has been involved. In addition db2pd could be used to look into the lock situation. Most likely runstats will run without any error when repeated some time later (reason for no feedback to my diagnostics question?).

Web Api Returning Json - [System.NotSupportedException] Specified method is not supported. (Sybase Ase)

I'm using Web api with Entity Framework 4.2 and the Sybase Ase connector.
This was working without issues returning JSon, until I tried to add a new table.
return db.car
.Include("tires")
.Include("tires.hub_caps")
.Include("tires.hub_caps.colors")
.Include("tires.hub_caps.sizes")
.Include("tires.hub_caps.sizes.units")
.Where(c => c.tires == 13);
The above works without issues if the following line is removed:
.Include("tires.hub_caps.colors")
However, when that line is included, I am given the error:
""An error occurred while preparing the command definition. See the inner exception for details."
The inner exception reads:
"InnerException = {"Specified method is not supported."}"
"source = Sybase.AdoNet4.AseClient"
The following also results in an error:
List<car> cars = db.car.AsNoTracking()
.Include("tires")
.Include("tires.hub_caps")
.Include("tires.hub_caps.colors")
.Include("tires.hub_caps.sizes")
.Include("tires.hub_caps.sizes.units")
.Where(c => c.tires == 13).ToList();
The error is as follows:
An exception of type 'System.Data.EntityCommandCompilationException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: An error occurred while preparing the command definition. See the inner exception for details.
Inner exception: "Specified method is not supported."
This points to a fault with with the Sybase Ase Data Connector.
I am using data annotations on all tables to control which fields are returned. On the colors table, I have tried the following annotations to limit the properties returned just the key:
[JsonIgnore]
[IgnoreDataMember]
Any ideas what might be causing this issue?
Alternatively, if I keep colors in and remove,
.Include("tires.hub_caps.sizes")
.Include("tires.hub_caps.sizes.units")
then this works also. It seems that the Sybase Ase connector does not support cases when an include statement forks from one object in two directions. Is there a way round this? The same issue occurs with Sybase Ase and the progress data connector.
The issue does not occur in a standard ASP.net MVC controller class - the problem is with serializing two one to many relationships on a single table to JSON.
This issue still occurs if lazy loading is turned on.
It seems to me that this is a bug with Sybase ASE, that none of the connectors are able to solve.

TransactionScope with Typed Dataset

Is it possible to use TransactionScope with a Typed Dataset?
as in:
using (var transaction = new TransactionScope())
{
typedDataSet.DeleteStuff(id);
typedDataSet2.DeleteSomeOtherStuff(id2);
transaction.Complete();
}
Will the the sql queries related to DeleteStuff(id) and DeleteSomeOtherStuff(id) actually be transactional if an error is thrown?
I have read this article by Bogdan Chernyachuk on Using Transactions with Strongly Typed datasets and I am hoping that I do not have to do it this way.
Short answer: Yes this is transactional.
Wasn't too hard to test either. I threw an exception just before the transaction.Complete() and the data wasn't deleted from the database.
using (var transaction = new TransactionScope())
{
typedDataSet.DeleteStuff(id);
typedDataSet2.DeleteSomeOtherStuff(id2);
throw new NullReferenceException();
transaction.Complete();
}
Weirdly though I profiled what was going on in the db with SQL SERVER Profiler and the stored procedures that were referenced through the typed dataset were executed on the server. However the data was somehow rolled back.

Cassandra Hector: How to verify the success/failure of a row update (error handling)

I'm using Hector to interact with a cassandra database from a java application. (Hector 1.0-1)
In this example, it shows how to insert (or update) a field.
mutator.addInsertion("650222", "Npanxx", HFactory.createStringColumn("state", "CA"));
MutationResult mr = mutator.execute();
However, there is not much information on the outcome of the operation. How can we verify if the operation was successful or not? The return value is a ResultStatus implementation and the 3 methods that can be called are:
mr.getHostUsed()
mr.getExecutionTimeNano()
mr.getExecutionTimeMicro()
Can I assume that if there were no exceptions calling the execute() method, that the operation succeeded?
It looks like the execute method doesn't declare any exceptions thrown because it will throw instances of HectorException which is a RuntimeException.
So yes, if no exceptions are thrown, the insert succeeded. Otherwise you will get an instance of HectorException thrown (likely HTimedOutException/HUnavailableException for problems on the Cassandra side and something else for something on the Hector side).

Resources