المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : facing problem with C# ODP.Net API(Oracle.DataAccess.dll) "Open cursors exceeded" exception is occured



C# Programming
06-01-2009, 09:44 AM
I am using the C# API to insert a xml file which is having schema******** attribute in it.
from the database side, we are using ODP.Net provider for oracle 10g.
ODP.Net is having full support in case of xml native functionalities and we are using non-structured xml type of storage.

Problem:
"Open cursors exceeded" exception is coming when importing more than 300 xml files into xmltype(Oracle) field with ODP.Net provider(Oracle.DataAccess.dll) using the relevant C# API for that.(I have Disposed all the resources using here).

here is the sample code:

string strFileContents = strXmlRecordContent;

if (Conn == null)
{
Conn = new Oracle.DataAccess.Client.OracleConnection(CatalogueDbConnection.ConnectionString);
}
if (Conn.State != ConnectionState.Open)
{
Conn.Open();
}
Oracle.DataAccess.Client.OracleCommand cmdInsertXmlRec = new Oracle.DataAccess.Client.OracleCommand();
cmdInsertXmlRec.Connection = Conn;

cmdInsertXmlRec.CommandText = "INSERT INTO XMLRecord (MetadataID,XMLData) VALUES(:Metadataid,:strFileContents ) ";
cmdInsertXmlRec.Parameters.Add(":Metadataid", Oracle.DataAccess.Client.OracleDbType.Int32).Value = MetadataID;
OracleXmlType Text = new OracleXmlType(Conn, doc);
cmdInsertXmlRec.Parameters.Add(":strFileContents", Oracle.DataAccess.Client.OracleDbType.XmlType).Value = Text;

cmdInsertXmlRec.ExecuteNonQuery();
if (cmdInsertXmlRec != null)
cmdInsertXmlRec.Dispose();

one main observation: cursors are opened if the xml file is having schemaLoaction attribute in it.