Can I work with Oracle Blob using Oracle Direct mode

Can I work with Oracle Blob using Oracle Direct mode

Postby ArtyomZzz » Mon 01 Nov 2010 08:55

Hello,

I use dotConnect Universal to connect to Oracle server in Direct mode.

I try select Blob data from table (select blobfield from testTable where id=xxxx):
1. in direct mode - it's return empty DataReader (HasRows==false)
2. in NOT direct mode - it's return valid DataReader (with data, HasRows==true)

I try get BLOB data using out parameter of stored proc:
1. in direct mode - it's return error "data not found"
2. in NOT direct mode - it's return valid Blob data

Is it limitation of Oracle Direct mode?

I read http://www.devart.com/dotconnect/oracle/docs/DirectMode.html, but there is no info about limitation on Blob fields.

Best regards,
Artyom.
ArtyomZzz
 
Posts: 4
Joined: Mon 01 Nov 2010 07:27

Postby Shalex » Tue 02 Nov 2010 14:29

I have tried to reproduce the problem with the following code using the 3.20.25 version of dotConnect Universal. It works. Please try:
DDL
Code: Select all
create table blobtable(
id number,
blobfield blob);
//insert some data into blobtable

create or replace procedure getblobfield(param out blob)
is
begin
select blobfield into param from blobtable where id=1;
end;


C# code
Code: Select all
        static void UseReader()
        {
            using (UniConnection conn = new UniConnection()) {
                conn.ConnectionString = "Provider=Oracle;server=***;port=1525;SID=***;Direct=true;uid=scott;pwd=tiger;";
                conn.Open();
                UniCommand cmd = conn.CreateCommand();
                cmd.CommandText = "select blobfield from blobtable where id=1";
                UniDataReader reader = cmd.ExecuteReader();
                Console.WriteLine("reader.HasRows = {0}", reader.HasRows);
            }
        }
        static void UseStoredProc()
        {
            using (UniConnection conn = new UniConnection()) {
                conn.ConnectionString = "Provider=Oracle;server=***;port=1525;SID=***;Direct=true;uid=scott;pwd=tiger;";
                conn.Open();
                UniCommand cmd = conn.CreateCommand();
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "getblobfield";
                cmd.Parameters.Add("param", UniDbType.Blob).Direction = System.Data.ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                if (cmd.Parameters["param"].Value != null)
                    Console.WriteLine("Parameter is NOT null.");
                else
                    Console.WriteLine("Parameter IS null.");
            }
        }
        static void Main(string[] args)
        {
            UseReader();
            UseStoredProc();
            Console.ReadLine();
        }

Here is my output:
reader.HasRows = True
Parameter is NOT null.


Please tell us the version (x.xx.xxx) and edition of your dotConnect Universal and the way we should modify this sample to reproduce the issue.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44

Postby ArtyomZzz » Wed 03 Nov 2010 06:46

Hello,

Cause of the problem is that I use Label Security on Oracle table. And in direct mode I have problem from my first post. I want to refuse from using Label Security for a long time and now I have yet one another reason for that.

Thank you for your respond!

Best regards,
Artyom.
ArtyomZzz
 
Posts: 4
Joined: Mon 01 Nov 2010 07:27


Return to dotConnect Universal