Page 1 of 1

corelab vs ms Oracle Drivers

Posted: Tue 10 Jul 2007 09:24
by kevinherring
Hi
I have been experiencing with an application as I have posted previously (AccessViolationException: Attempted to read or write protected memory)

I have tried everything I can, and the only thing left to do is to remove the OraDirect drivers. Although I am not sure whether this has fixed the problem, I have come across a number of differences between the OraDirect drivers and the built in MS Oracle drivers (with the OracleCommand object).

Firstly with the MS driver the parameters have to be called the same as in the procedure. Doesnt really matter either way but I thought I would mention it.

The MS driver doesnt allow you to set a parameter to Nothing, you have to set it to DBNull.Value. The OraDirect driver does. What happens internally? Does it convert Nothing to DBNull.Value?

The most concerning thing was that the OraDirect drivers seem to allow parameter values that are not of the type you specified them as. For example I realised that some old code was specifying a parameter as a Long and then I was passing in an Int64. This goes back to my old days when I thought that an Oracle Long was a number as opposed to a long string. I know my code was wrong, but I am amazed the drivers allowed it! Also the same happened with Dates/Varchars and int32/numbers.

Shouldn't the OracleCommand object be a little stricter?

Incidentally I notice that version 4 requires 'out' cursors to have their direction specified as output, whereas version 3 doesnt seem to care.

Thanks
Kevin

Posted: Tue 10 Jul 2007 11:12
by Alexey
Yes, Nothing is converted into DBNull.Value. This is our simplification.
Version 4 can now work with in-cursor parameters, so the direction specification is needed.

Posted: Tue 10 Jul 2007 11:33
by kevinherring
Thanks Alexey but the most important question remains unanswered.

How come you can pass in an int64 into a parameter you have defined as a Long?

Posted: Tue 10 Jul 2007 12:55
by Alladin
kevinherring wrote:Thanks Alexey but the most important question remains unanswered.

How come you can pass in an int64 into a parameter you have defined as a Long?
Long=Int64

Posted: Tue 10 Jul 2007 12:57
by kevinherring
no Alladin, Long in oracle is a very long string (up to 2GB I believe)

Posted: Wed 11 Jul 2007 09:36
by Alexey
We will check this carefully and post the answer soon.

Posted: Wed 11 Jul 2007 09:46
by kevinherring
Thanks Alexey.

BTW removing to OraDirect drivers didnt fix my "AccessViolationException: Attempted to read or write protected memory" problem.

LOB instead of LONG

Posted: Thu 19 Jul 2007 02:09
by scott.pedersen
Hi,

Wouldn't it be better to use a LOB instead of LONG, as a LONG data type in Oracle has quite a few restrictions on it.

I think Oracle recommends using LOBs as opposed to LONG.

Cheers,

Scott.

Posted: Thu 19 Jul 2007 10:32
by Alexey
You are right, it is better to use LOBs.

Posted: Thu 19 Jul 2007 12:10
by Alexey
kevinherring wrote:Thanks Alexey but the most important question remains unanswered.
How come you can pass in an int64 into a parameter you have defined as a Long?
This is a designed behaviour. We are trying to convert any data if the conversion is possible.
Long is a string.
We can convert any data to a string (except binary data).

Posted: Tue 24 Jul 2007 09:49
by kevinherring
Thanks Alexey.
Just to confirm, I am not using the Oracle Long datatype, I am using the .NET Long datatype. I mistakenly assumed that they were the same thing.