I am writing a .Net application that runs on top of an Oracle 11.2.0.2.0 database that stores dates in columns of type "TIMESTAMP(6) WITH LOCAL TIME ZONE". When there is a date stored into the column and it falls within DST, the date is read incorrectly when using the Oracle.ManagedDataAccess library. It appears to always write/update dates correctly. Also, when using the Oracle.DataAccess library, it always handles the dates correctly.
In my example I am using timezone 'America/New_York' and date/time of 08/01/2014 12:00:00. Here is a snippet of code that reads the date incorrectly:
IDbConnection cxn = new Oracle.ManagedDataAccess.Client.OracleConnection(ConnStr);
// Using the following library works correctly:
// IDbConnection cxn = new Oracle.DataAccess.Client.OracleConnection(ConnStr);
cxn.Open();
var cmd = cxn.CreateCommand();
cmd.CommandText = "alter session set time_zone='America/New_York'";
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT TEST_DATE FROM TEST_TABLE WHERE ROWNUM=1";
return (DateTime)cmd.ExecuteScalar();
When the column is updated with value 08/01/2014 12:00:00, it is read as 08/01/2014 11:00:00. If I use a date that does not fall within DST (such as 12/01/2014 12:00:00), it reads the date correctly. Any ideas on this? I have been searching all over but have not found any documentation on this issue. I may have to switch back to the Oracle.DataAccess, but was hoping to avoid it. Thanks in advance!