[Info-ingres] .NET Data Provider closes ingres connection prematurely
James Higson
James.Higson at saasie.net.au
Thu Feb 25 22:04:30 UTC 2016
Hello World,
Ingres Release II 10.2.0 (int.w32/100).
I have in interesting problem. We have been successfully using .NET Data Provider 2.1 for a while to select data and never had a problem, however we have never needed to update/insert until recently because we do all that through OpenROAD Server. Recently my colleague wrote an insert that works fine, but when I copied his approach it always fails. The InsertCommand.ExecuteNonQuery() raises an exception with the message "Connection closed". When I check the errlog.log on the server, it states "E_GC4807_CONN_ABORT Aborting client connection, reason follows" and "E_US0005 Could not open the iirelation table".
Here is a sample of my code:
using (var iiConnection = new IngresConnection(ConnectionString))
{
iiConnection.Open();
var mqt = iiConnection.BeginTransaction(IsolationLevel.RepeatableRead);
// Check that a select works inside the MQT prior to the insert which is failing.
var dataReader = new IngresCommand(@"SELECT late_date FROM cdat", iiConnection, mqt).ExecuteReader();
while (dataReader.Read())
{
var appDate = Convert.ToDateTime(DataTypeHelpers.GetIIDate(dataReader.GetValue(0)));
}
dataReader.Close();
_query = @"INSERT INTO cdat (late_date) VALUES (" + DateTime.Today + ")";
var ingresDataAdapter = new IngresDataAdapter { InsertCommand = new IngresCommand(_query, iiConnection, mqt) };
// This insert causes an exception. The message is "Connection closed".
if (ingresDataAdapter.InsertCommand.ExecuteNonQuery() == 0)
{
Log.Error("No row inserted into CDAT unexpectedly");
mqt.Rollback();
return false;
}
mqt.Commit();
iiConnection.Close();
}
Any help would be much appreciated.
Regards,
James Higson
Consulting Director
SAASie Hosting (A Division of GUI-tek Consulting)
Bus +61 3 9578 9307 | Home +61 3 9502 7700 | Mob +61 417 185 980
Email james.higson at saasie.net.au<mailto:james.higson at saasie.net.au>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.planetingres.org/pipermail/info-ingres/attachments/20160225/d421ddf5/attachment.html>
More information about the Info-ingres
mailing list