Impossible to connect using ODP.Net

Posts   
 
    
samy
User
Posts: 18
Joined: 16-Sep-2011
# Posted on: 16-Sep-2011 15:25:11   

Hello all,

First, version numbers simple_smile I'm using LLBLGEN Pro 3.1 Final (June 17th 2011) on a Windows 7 Professional 64bits. I want to reverse-engineer entities from an Oracle Express 11g (32bits, since it's the only version at the moment) to NHibernate, using ODP.Net. I'm using .net 4

I started by using the MS Oracle Provider, which worked out of the box, but since i encountered the NUMBER to Decimal problem, and since there's no way to handle the NUMBERS correctly except using ODP.Net, i tried doing that.

Following advice from this forum, i decided against trying to merge to imports with two providers and created a brand new project.

First LLBLGEN complained that ODP.Net wasn't installed, which surprised me since i thought that it was bundled in Oracle XE. I installed the ODP.Net 64 for .Net 4, and now it looks like the tnsnames.ora i have in Oracle XE isn't recognized anymore.

I'd like to know if anyone can help with these problems; i have a feeling i could easily wreck my dev box and wouldn't want to spend hours desinstalling/reinstalling everything to do the mapping.

samy
User
Posts: 18
Joined: 16-Sep-2011
# Posted on: 16-Sep-2011 15:54:34   

Alternately, is it possible for the Entities<->DB mapping to use a converter that turns the Decimal into Integers or Longs? It could allow me to keep the existing project and explicitely convert all the ids in the mapping? Are there any problems with this approach (excluding the possible overflows which shouldn't be a problem at first since we're well below the maximum value for integers) ?

[EDIT] I wrote an IntegralDecimalTypeConverter for Nhibernate but it looks like it's not added to the mappings. Is there a limitation on TypeConverters that makes it so that you can't apply them on a entity key?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Sep-2011 20:17:01   

samy wrote:

I'd like to know if anyone can help with these problems; i have a feeling i could easily wreck my dev box and wouldn't want to spend hours desinstalling/reinstalling everything to do the mapping.

In the machine.config file of your .NET version (if you run the .net 4 runner, you should look in the machine.config file of .net 4, otherwise the .net 2 one), in the dbproviderfactories section, is there a line for Oracle.DataAccess? If not, no dbproviderfactory is registered and therefore the driver can't access / find it.

Also please post the complete exception message and stack trace.

Related threads: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=17453 http://llblgen.com/tinyforum/Messages.aspx?ThreadID=19868

samy wrote:

Alternately, is it possible for the Entities<->DB mapping to use a converter that turns the Decimal into Integers or Longs? It could allow me to keep the existing project and explicitely convert all the ids in the mapping? Are there any problems with this approach (excluding the possible overflows which shouldn't be a problem at first since we're well below the maximum value for integers) ?

[EDIT] I wrote an IntegralDecimalTypeConverter for Nhibernate but it looks like it's not added to the mappings. Is there a limitation on TypeConverters that makes it so that you can't apply them on a entity key?

Show us your .typeimports file. It's likely you LLBLGen can't find your assembly, or maybe you build the typeConverter in .net4 and you are running the default designer while you should run the .net4 version (which is in the installation folder). Anyway please open a new thread for clarity.

David Elizondo | LLBLGen Support Team
samy
User
Posts: 18
Joined: 16-Sep-2011
# Posted on: 19-Sep-2011 09:19:09   

Thanks daelmo,

i'm going to keep focusing on the type converter route since odp.net still refuses to play along with llblgen. FWIW, i have the following in the C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

<DbProviderFactories>
      <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    
    </DbProviderFactories>

so i guess it should be able to be loaded with the .net4 version of LLBLGEN Pro 3.1. I'll retry correcting this problem again later.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Sep-2011 10:39:40   

Just to make sure.

Which of the following EXEs do you run? 1- LLBLGenPro 2- LLBLGenPro_x86 3- LLBLGenPro_NET40

samy
User
Posts: 18
Joined: 16-Sep-2011
# Posted on: 19-Sep-2011 13:53:29   

I'm running the third exe for .net 4

So far, as i mentionned, i'm going to try the typeconverter route. If time allows, i'll try to investigate the odp.net problem; however from the threads, it looks like i'm not the only one encountering a lot of hassle to have it play nicely along with llblgen

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 19-Sep-2011 14:57:15   

We ourselves dont have problems with ODP.NET, the only issue we see re-occurring on the forums once in a while is bit-differences, e.g. one installs 32bit ODP.NET on 64bit OS, tries to run 64bit application, ODP.NET doesn't show up, or vice versa; people install ODP.NET but not the .NET 4 version, run .NET 4 application, it isn't found... Unfortunately, not problems we can fix ourselves, as all we do is create a factory from ODP.NET using DbProviderFactories.GetFactory(), i.o.w.: it is either configured properly and runs, or ODP.NET misconfigured something which is out of our scope...

Frans Bouma | Lead developer LLBLGen Pro
samy
User
Posts: 18
Joined: 16-Sep-2011
# Posted on: 20-Sep-2011 14:12:39   

I understand fully that the problem falls into my lap (or oracle's since the installer is a bit obscure). It's all the more obvious since an uninstall/reinstall of ODP.Net now allows LLBLGEN to load the driver properly. Either it's a reboot that did the trick or there's something i don't control here ...