corelab vs ms Oracle Drivers

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

corelab vs ms Oracle Drivers

Post by kevinherring » Tue 10 Jul 2007 09:24

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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 10 Jul 2007 11:12

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.

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Tue 10 Jul 2007 11:33

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?

Alladin
Posts: 149
Joined: Mon 27 Nov 2006 16:18
Contact:

Post by Alladin » Tue 10 Jul 2007 12:55

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

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Tue 10 Jul 2007 12:57

no Alladin, Long in oracle is a very long string (up to 2GB I believe)

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 11 Jul 2007 09:36

We will check this carefully and post the answer soon.

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Wed 11 Jul 2007 09:46

Thanks Alexey.

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

scott.pedersen
Posts: 21
Joined: Tue 06 Jun 2006 03:14
Location: Auckland, New Zealand

LOB instead of LONG

Post by scott.pedersen » Thu 19 Jul 2007 02:09

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.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 19 Jul 2007 10:32

You are right, it is better to use LOBs.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 19 Jul 2007 12:10

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).

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Tue 24 Jul 2007 09:49

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.

Post Reply