Page 1 of 1

OracleLob.Close error (OraDirect 4.50)

Posted: Wed 19 Mar 2008 08:27
by KentKWK
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

Posted: Wed 19 Mar 2008 09:03
by Alexey.mdr
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.

Posted: Fri 21 Mar 2008 07:14
by KentKWK
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

Posted: Fri 21 Mar 2008 08:04
by Alexey.mdr
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.

Posted: Fri 21 Mar 2008 09:20
by KentKWK
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?

Posted: Fri 21 Mar 2008 10:22
by Alexey.mdr
The problem has been reproduced.
We are investigating this problem.
You will be notified on results as soon as possible.

Posted: Sat 22 Mar 2008 01:36
by KentKWK
Thanks for the immediate response.
Looking forward for the solution :D

Regards,
Kent

Posted: Mon 24 Mar 2008 10:56
by Alexey.mdr
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.

Posted: Wed 26 Mar 2008 00:42
by KentKWK
OK, got it. All the best in the process.
Looking forward for good news and thanks again. :)

Regards,
Kent

Posted: Wed 26 Mar 2008 13:07
by Alexey.mdr
Thanks Kent for the understanding!
We will make essential changes in the next build.