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!

EF Core 3.1 Beta OracleException: ORA-01460

user606112Jul 12 2020 — edited Jul 16 2020

Adding an image and saving the context ORA-01460 occurs.

DB-Set in Model:

public class Picture

{

    public int PictureID { get; set; }

    public byte\[\] Bild { get; set; }

    public DateTime Ludsys { get; set; }

    public int OrderDetailID { get; set; }

    public OrderDetail OrderDetail { get; set; } // Navigationseigenschaft

} // Picture

Table in DB:

Table in ORA DB.JPG

If I load the image and save it with SQL-Developer it can be read and displayed in the application.

Create the picture:

...

picture = new Picture

{

 Bild = null,

 Ludsys = DateTime.Now,

 OrderDetail = orderdetail

}; // picture

imgBild.DataContext = picture;

imgBild.Source = FileToBitmapImage(dlg.FileName); // Bild aus Filesystem laden und anzeigen

context.Pictures.Add(picture);

pictures.Add(picture);

ind = pictures.Count - 1; // Index für den neuen Datensatz ist pictures.Count - 1

...

    private BitmapImage FileToBitmapImage(string source)

    {

        try

        {

            if (source == string.Empty) { return null; }

            BitmapImage bitmapimage = new BitmapImage();

            using FileStream filestream = File.Open(source, FileMode.Open);

            bitmapimage.BeginInit();

            bitmapimage.CacheOption = BitmapCacheOption.OnLoad;

            bitmapimage.StreamSource = filestream;

            bitmapimage.EndInit();

            return bitmapimage;

        } // try

        catch (Exception ex)

        {

            MessageBox.Show(ex.Message, "Nachricht", MessageBoxButton.OK, MessageBoxImage.Error);

            return null;

        } // catch

    } // FileToBitmapImage

ImageConverter:

     public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

    {

        try

        {

            if (value == null) { return null; }

            byte\[\] byteArray = (byte\[\])value;

            using MemoryStream memorystream = new MemoryStream(byteArray);

            BitmapImage bitmapimage = new BitmapImage();

            bitmapimage.BeginInit();

            bitmapimage.CacheOption = BitmapCacheOption.OnLoad;

            bitmapimage.StreamSource = memorystream;

            bitmapimage.EndInit();

            return bitmapimage;

        } // try

        catch (Exception)

        {

            return null;

        } // catch

    } // Convert

    // ConvertBack (Ziel -> Quelle)

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

    {

        try

        {

            if (value == null) { return null; }

            ImageSource imagesource = (ImageSource)value;

            BitmapSource bitmapsource = imagesource as BitmapSource;

            BitmapEncoder encoder = new JpegBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(bitmapsource));

            using MemoryStream ms = new MemoryStream();

            encoder.Save(ms);

            byte\[\] bytearray = ms.ToArray();

            return bytearray;

        } // try

        catch (Exception)

        {

            return null;

        } // catch

    } // ConvertBack
This post has been answered by Alex Keh-Oracle on Jul 14 2020
Jump to Answer

Comments

Alex Keh-Oracle

I tried your C# app with a table using a DATE column and TIMESTAMP column. In both cases with either ODP.NET Core 2.19.80 or 2.19.70, I didn't hit an error. I used DB 19c. Which DB version did you use?

4252326

I found out that there must be at least one record in the table. For example:

Table Design:

Name
Type
Size
IDNumber0
DateDATE7
TimeTIMESTAMP0
Time2INTERVAL DAY TO SECOND0

Table Data:

ID
DateTimeTime2
1(Null)(Null)(Null)

Then replace the [column] in the sql below:

var sql = $"select(CASE WHEN 1 = 0 THEN a.\"[column]\" ELSE NULL END) as C0 from \"YOUR TABLE NAME\" a ";

 

[Date]: reproduced

[Time]: can't reproduce

[Time2]: reproduced

DB version: 11/12/18/19c

Alex Keh-Oracle

I added the interval column and added one row of data, but still can't reproduce the problem with the 2.19.80 version against the data or interval column. Do you want to send us your trace? Just add these two lines and run your app.

OracleConfiguration.TraceFileLocation = @"D:\traces";

OracleConfiguration.TraceLevel = 7;

You can send the trace file to dotnet_us (at) oracle.com.

4252326

Thank you. The email has been sent. I hope it's useful to you.

Alex Keh-Oracle

This bug appears to be the same as Bug 26123054.

4252326

Will this problem be fixed recently?

Alex Keh-Oracle

The bug hasn't been fixed yet. We're still evaluating the root cause.

Alex Keh-Oracle
Answer

The bug has been fixed in our main code line. My expectation is that the fix will be in the ODP.NET Core 19.10 release.

Marked as Answer by 4252326 · Sep 27 2020
1 - 8

Post Details

Added on Jul 12 2020
8 comments
746 views