Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Difference between Dates / Entity Framework Core 3.1

1495799May 30 2020 — edited Jul 21 2020

Hello,

I have an exception when I try to get the difference between two dates (in Days) with the new Oracle.EntityFrameworkCore 3.19.0-beta1 NuGet package :

var row = (

        from r in dbContext.Entitites

        select new { (DateTime.Now - r.DateTimeColumn).Days }

    ).FirstOrDefault();

System.InvalidCastException: 'Specified cast is not valid.'

   at Oracle.ManagedDataAccess.Client.OracleDataReader.GetDecimal(Int32 i)

   at Oracle.ManagedDataAccess.Client.OracleDataReader.GetValue(Int32 i)

   at System.Data.Common.DbDataReader.GetFieldValue[T](Int32 ordinal)

This post has been answered by 1495799 on Aug 5 2021
Jump to Answer

Comments

fetchdesigns

Perhaps there is a better solution, but what worked for me is (if you are using Windows)...

  1. Click the start button (the windows icon at the lower left of your screen)
  2. Start typing "java" and select "Configure Java" when it appears
  3. Open the "Security" tab
  4. Drag the security setting down to "Medium"

I believe the issue is with the Pitney Bowes certificate conflicting with newer versions of Java.  You may also be able to downgrade your version of Java to get it working, but that may be less secure.  Your call.

fetchdesigns

I was able to resolve this by doing the following (on Windows 7)...

  1. Click the Windows button at the bottom left on your screen
  2. Type "java" and select "Configure Java" when it appears
  3. Open the "Security" tab
  4. Drag the setting down to "medium"

From what I understand the issue is with the Pitney Bowes certificate conflicting with newer versions of Java.  You may also be able to downgrade your version of Java to get it working, but that may be less secure.  Your call.

1 - 2

Post Details

Added on May 30 2020
12 comments
3,391 views