ODP.NET Core BLOB/CLOB read error — oracle-tech

    Forum Stats

  • 3,716,133 Users
  • 2,242,960 Discussions
  • 7,845,840 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

ODP.NET Core BLOB/CLOB read error

user7666335
user7666335 Member Posts: 3
edited August 2018 in ODP.NET

Hello.

ODP.NET Core is already in prelease, but still not supports elementary read blob/clob fields.

This simple code  falls with "TTC Errror":

using (OracleConnection conn = new OracleConnection("Data Source=db;User ID=userid;Password=pass;Pooling=False;"))
{
  conn.Open();
  var sql = "SELECT id, blobdata FROM templ";
  OracleCommand cmd = new OracleCommand(sql, conn);
  cmd.CommandType = CommandType.Text;
  OracleDataReader reader = cmd.ExecuteReader();
   using (reader)
   {
   while (reader.Read()) //TTC Error
   {
   }
   }

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited August 2018

    I tested out your sample code with a table that contains BLOB data and ODP.NET Core Beta 3. It worked.

    Can you provide more details on the error? An ODP.NET trace would be especially useful.

    Here's sample code for setting up and outputting a trace for ODP.NET Core.

    OracleConfiguration.TraceFileLocation = @D:\traces; <-- Choose appropriate directory

    OracleConfiguration.TraceLevel = 7;

  • user7666335
    user7666335 Member Posts: 3
    edited August 2018

    It doesn't worked for me

    Here sample code and traces.

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

    sql:

    create table t_cblob_test

    (

    id integer primary key,

    data clob

    );

    insert into t_cblob_test values (1, null);

    insert into t_cblob_test values (2, 'Hello, World!');

    C#

    static void Main(string[] args)

    {

    OracleConfiguration.TraceFileLocation = @A:\;

    OracleConfiguration.TraceLevel = 7;

    using (var connection = new OracleConnection("Data Source=database; User ID=user; Password=password"))

    {

    connection.Open();

    using (var command = new OracleCommand("SELECT id, data FROM t_cblob_test", connection) { CommandType = CommandType.Text })

    using (var reader = command.ExecuteReader())

    {

    while (reader.Read())

    {

    }

    }

    }

    }

    output:

    Unhandled Exception: System.Exception: TTC Error

       at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int64 initialLOBFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Int64[]& rowsAffectedByArrayBind, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause, List`1& implicitRSList, Boolean bLOBArrayFetchRequired)

       at OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(Int32 noOfRowsToFetch, Boolean fillReader, Boolean returnPSTypes)

       at Oracle.ManagedDataAccess.Client.OracleDataReader.Read()

       at odp.net.clob.Program.Main(String[] args) in H:\odp.net.clob\odp.net.clob\Program.cs:line 20

    traces:

    https://pastebin.com/gFPTQgRB

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited August 2018

    Can you try your code out with 11.2 DB or higher? The problem is likely using an older DB server version. ODP.NET Core only supports 11.2 DB and higher. It does not support DB 10.2.

    I tested the code snippet using DB 12.2 successfully.

  • user7666335
    user7666335 Member Posts: 3
    edited August 2018

    It is absolutely impossible upgrade production business servers for a simple data access library.

    In odp.net managed (not core) it works fine. Can you copy-past code non-worked part of code from it?

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited August 2018

    If Oracle fixed this particular issue, it does not guarantee you won't find other compatibility issues using DB 10.2. We have not done comprehensive 10.2 testing. If there's a 10.2 problem that requires a DB server fix or a client fix outside our immediate dev team, we cannot ensure that team will provide a fix since 10.2 extended support ended five years ago.

    Because ODP.NET Core will go production with ODAC 18c, it follows the support policy of the Oracle DB Client 18c, which is backwards compatible with 11.2 DB servers and higher.

This discussion has been closed.