ora-03115 running on mono

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

ora-03115 running on mono

Post by flutos » Thu 26 Aug 2010 15:36

Im getting ora-03115: unsupported network datatype or representation when I run on mono but it works ok on windows. The one thing running on mono is that I have to set directmode=true and I noticed that another post mentioned that this mode doesnt support binary_double and the table being selected has a binary double in it . Given that , is there any way to not use direct mode on mono to get arround this issue or is there any other way we can get around this issue. The main reason we are looking at devart is to use it on mono since monos oracle driver has a lot of issues but so far devart seems to work pretty good on mono other than this issue so any help would be appreciated.

thanks

scott

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 30 Aug 2010 09:17

dotConnect for Oracle works only in Direct Mode on Mono. Here is a description of Direct Mode with a list of its limitations (BINARY_DOUBLE is not available): http://www.devart.com/dotconnect/oracle ... tMode.html.
As a workaround, we recommend you to create a view for your table with BINARY_DOUBLE and to cast this type to NUMBER:

Code: Select all

--DROP TABLE B_D;
CREATE TABLE B_D (
  ID NUMBER(38),
  BD BINARY_DOUBLE,
  CONSTRAINT PK_B_D PRIMARY KEY (ID));

CREATE OR REPLACE VIEW B_D_VIEW (
  ID,
  BD
)
AS
  SELECT "ID",CAST("BD" as NUMBER) FROM B_D
;

flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

Post by flutos » Mon 30 Aug 2010 15:25

this would handle selecting but then there is also inserts and updating. The other problem is we are using nhibernate and supporting other databases like sqlserver so we are limited on how much we hard coding this specific situation. Is there some other type we can use rather than binary_double and binary_float to support saving a .net double . for example , try saving a .net Double.Maxvalue into oracle into anything other than an binary_double. I tried a fiew things like using Number but I couldnt find anything that works other than binary_double . Is there another oracle type that might work or maybe on the backend it could be binary_double but devar parameter could be something that would would in direct mode. Is there any way to get direct mode to support these type?

thanks

scott

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 02 Sep 2010 16:39

We are investigating the issue. I will notify you about the results.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 30 Sep 2010 12:39

We recommend you using the following workarounds when working with BINARY_DOUBLE:
1) select -
select TO_CHAR(binary_double_column) from myTable
2) insert -
cmd.Parameters.Add("p2", OracleDbType.VarChar).Value = Double.MaxValue.ToString("r", CultureInfo.InvariantCulture);

There is no technical possibility to implement the BINARY_DOUBLE support in Direct Mode at the moment.

flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

Post by flutos » Thu 30 Sep 2010 12:49

well , we are using nhibernate to use both oracle and sqlserver so Ill have to see if I can get nhibernate to do this but can I do this even though the field in the database is defined as binary_double but we pass it a string?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 01 Oct 2010 12:32

Yes, please define the field in your database as binary_double and pass a string to it.

flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

Post by flutos » Fri 01 Oct 2010 12:41

ok, Ill give this a try and see if I can get nhibernate to do that and see if it works.

flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

Post by flutos » Mon 18 Oct 2010 20:29

it all works ok but when I try to persist a Double.MaxValue , it inserts ok but the select returns this error:

{"Input string was not in a correct format."}

is there a limitation of this based on the size of the double coming back? when that double.maxvalue comes back as a string and its converted back to a double you have to be carefull since you could run into a rounding error and cause this double.maxvalue be rounded up and become invalid if you dont specify the format option of "r". This is a know problem to watch out for when converting its string representation to a double.maxvalue so do you think a problem like this could be happening?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 20 Oct 2010 14:37

Please modify the following sample so that we can reproduce the error in our environment.

Code: Select all

    // CREATE TABLE BD_table (BD_column BINARY_DOUBLE);

    static double result;
    using (OracleConnection conn = new OracleConnection()) {
        conn.ConnectionString = "server=db;port=***;SID=***;Direct=true;uid=***;pwd=***;";
        conn.Open();
                
        OracleCommand cmd = conn.CreateCommand();
        cmd.CommandText = "truncate table bd_table";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "insert into bd_table values (:p1)";
        cmd.Parameters.Add("p1", OracleDbType.VarChar).Value = Double.MaxValue.ToString("r");
        cmd.ExecuteNonQuery();

        cmd.Parameters.Clear();
        cmd.CommandText = "select TO_CHAR(bd_column) from bd_table";
        OracleDataReader reader = cmd.ExecuteReader();
        while (reader.Read()){
            result = double.Parse(reader.GetValue(0).ToString());
        }
    }
Also please tell us your versions of dotConnect for Oracle (x.xx.xxx) and Oracle Server (xx.x.x.x).

flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

Post by flutos » Wed 20 Oct 2010 15:16

I see the problem, in your sample you have Value= Double.MaxValue.ToString("r");

if you dont do the ToString then you will get the error when you read it back . The problem is Nhibernate thinks this is a double going into a number field so of course it doenst do a ToString which is probably the problem. Unfortunatly I have no hook into nhibernate to do the ToString so Im a little stuck here. Im not sure if you know nhibernate but do know if there is a way to do this through nhibernate?

flutos
Posts: 31
Joined: Tue 06 Oct 2009 21:55

Post by flutos » Wed 20 Oct 2010 19:06

I figured it out, I needed to defined my own custom nhibernate Double type , with that , I can intercept the setting and getting of the parameter values and convert the double to a string using the "r" format to prevent the double from rounding up which fixed this problem.

thanks

scott

Post Reply