OracleLob.Close error (OraDirect 4.50)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
KentKWK
Posts: 9
Joined: Tue 18 Mar 2008 04:51

OracleLob.Close error (OraDirect 4.50)

Post by KentKWK » Wed 19 Mar 2008 08:27

Hello.

I have problem closing the stream.

Error is as follows:
"ORA-22275: invalid LOB locator specified"

The following code produce the error.
cmd = "SELECT FILE_CONTENT FROM " + info.pathinfo.TableName + " WHERE ID = " + id";
oCommand = new OracleCommand(cmd, oConnection);
oDtReader = oCommand.ExecuteReader();

if (oDtReader.HasRows)
{
oDtReader.Read();

oLob = oDtReader.GetOracleLob(oDtReader.GetOrdinal("FILE_CONTENT"));

}
oDtReader.Close();

oLob.Close(); <-- error occurs here
FYI, I am able to run this code without fail using OraDirect 3.55 previously. The error occurs after I change my OraDirect to version 4.50.

Any idea how to rectify the problem?

Helps are greatly appreciated. Thanks in advance.

Regards,
Kent

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Wed 19 Mar 2008 09:03

Please send me a small test project to reproduce the problem.
Please include the definition of your own database objects.
Do not use third party components.
If it is impossible for you to create the test project, send us a larger piece of
your code where the error occurs.

KentKWK
Posts: 9
Joined: Tue 18 Mar 2008 04:51

Post by KentKWK » Fri 21 Mar 2008 07:14

Hello. Sorry for the late reply.
Below is the larger portion of the code in my sample test project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CoreLab.Data;
using CoreLab.Oracle;

namespace TestProject
{
public partial class Form1 : Form
{
private string tableName = System.Configuration.ConfigurationManager.AppSettings["TableName"];
private string userID = System.Configuration.ConfigurationManager.AppSettings["UserID"];
private string pwd = System.Configuration.ConfigurationManager.AppSettings["Password"];
private string server = System.Configuration.ConfigurationManager.AppSettings["Server"];
private string port = System.Configuration.ConfigurationManager.AppSettings["Port"];
private string Sid = System.Configuration.ConfigurationManager.AppSettings["Sid"];
private string connString = string.Empty;
OracleLob oLob;
OracleDataReader oDtReader;
OracleConnection conn;
OracleCommand command;

public Form1()
{
InitializeComponent();
}

private void btnClick_Click(object sender, EventArgs e)
{
connString = "User Id=" + userID + ";Password=" + pwd + ";Direct=true;Server=" + server + ";port=" + port + ";Sid=" + Sid;
conn = new OracleConnection(connString);
conn.Open();
command = new OracleCommand("SELECT * FROM " + tableName + " WHERE ID = 2094", conn);
oDtReader = command.ExecuteReader();
if (oDtReader.HasRows)
{
oDtReader.Read();
oLob = oDtReader.GetOracleLob(oDtReader.GetOrdinal("FILE_CONTENT"));
oLob.Close(); //<---Exception occurs here
}
oDtReader.Close();
conn.Close();
}
}
}
Fyi, I am using Oracle 10g Client, OraDirect 4.50, VS2005.
The "FILE_CONTENT" is a BLOB type column in my database table.
The value for the ID column does not matter as long as the row contains the blob content in the FILE_CONTENT column.
I faced this problem as well while using VS2008 with the same coding as shown above.
Hope this information may help. :)

Regards,
Kent

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Fri 21 Mar 2008 08:04

Oracle Error :: ORA-22275
invalid LOB locator specified
Cause:

There are several causes:
(1) the LOB locator was never initialized;
(2) the locator is for a BFILE and the routine expects a BLOB/CLOB/NCLOB locator;
(3) the locator is for a BLOB/CLOB/NCLOB and the routine expects a BFILE locator;
(4) trying to update the LOB in a trigger body -- LOBs in trigger bodies are read only;
(5) the locator is for a BFILE/BLOB and the routine expects a CLOB/NCLOB locator;
(6) the locator is for a CLOB/NCLOB and the routine expects a BFILE/BLOB locator;
Action:
For (1), initialize the LOB locator by selecting into the locator variable or by setting the LOB locator to empty.
For (2),(3), (5) and (6)pass the correct type of locator into the routine.
For (4), remove the trigger body code that updates the LOB value.

KentKWK
Posts: 9
Joined: Tue 18 Mar 2008 04:51

Post by KentKWK » Fri 21 Mar 2008 09:20

Hello.

FYI, I was able to run the sample code without error on PC which using OraDirect 3.50, but I unable to run the sample code perfectly on a PC which using OraDirect 4.50. :shock:

I have no idea which causes mentioned above cause an exception in my coding. :?

Is there any changes in the behaviour of the OracleLob between OraDirect 3.50 and OraDirect 4.50?

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Fri 21 Mar 2008 10:22

The problem has been reproduced.
We are investigating this problem.
You will be notified on results as soon as possible.

KentKWK
Posts: 9
Joined: Tue 18 Mar 2008 04:51

Post by KentKWK » Sat 22 Mar 2008 01:36

Thanks for the immediate response.
Looking forward for the solution :D

Regards,
Kent

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Mon 24 Mar 2008 10:56

We are doing our best to solve the problem right now.
We have analysed the problem and determined that the situation is quite involved.
We are working on deploying a solution, but please be warned that this will
take some time and plan your development strategy accordingly.

KentKWK
Posts: 9
Joined: Tue 18 Mar 2008 04:51

Post by KentKWK » Wed 26 Mar 2008 00:42

OK, got it. All the best in the process.
Looking forward for good news and thanks again. :)

Regards,
Kent

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Wed 26 Mar 2008 13:07

Thanks Kent for the understanding!
We will make essential changes in the next build.

Post Reply