Getting ODP.NET Managed Driver to work with ADO.NET TableAdapters - oracle

I've got a WCF service (.NET Framework 4) that uses Table Adapters (xsd) and System.Data.OracleClient as a dependency. I'm trying to switch to the new Oracle.ManagedDataAccess.Client.
I've installed the ODP.NET Managed Driver from NuGet. Everything went fine, it installed correctly as a reference.
I've put the following in the app.config file:
<system.data>
<DbProviderFactories>
<add name="ODP.NET Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
and changed the providerName attribute for the ConnectionString to providerName="Oracle.ManagedDataAccess.Client"
Then I double click on the Table Adapter (the xsd file) and right click on the Table Adapter I want to change and click on Properties. Then I get this dialog up:
Note: The ConnectionString has been removed from the screenshot
When I change the value of Provider to Oracle.ManagedDataAccess.Client I get the following error:
Do you have any idea how I can achieve this?

If you want to use VS designers and wizards for Tableadapters or Entity Framework, you must install Oracle Developer Tools for Visual Studio (ODT). Note that this does not support VS Express Edition. In your specific case, this install will update the machine config so that ODP.NET is registered as a factory provider.
You can download ODT here:
http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
As a side note - please note that the Nuget package hosted on nuget.org was not put there by Oracle. If you want an official download you should get it from oracle.com.

Related

Oracle Entity Data Model(ODP.NET)

We are trying to create an Entity Data model (edmx) file using Database first approach for Oracle Db.( We already have a running version of edmx for SQL Server).
Installed ODP.NET package which includes Oracle.ManagedDataAccess.dll and Oracle.ManagedDataAccess.EntityFramework.dll in Visual studio 2017 for Framework 4.5 via Nuget Packages
Manually modified the connection string for Oracle as
<connectionStrings>
<add name="FacetsDataModel"
connectionString="metadata=res://*/EntityDataModel.csdl|res://*/EntityDataModel.ssdl|res://*/EntityDataModel.msl;provider=System.Data.OracleClient;provider connection string=”Data Source=***;User Id=**;Password=***;”;" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>
The above approach didn't work because we found out that we are missing ODP.Net Managed Provider in the system. So we tried installing ODT Tools for Visual Studio 2013(didn’t work) uninstalled the same and installed 2017(still the same issue)
We found out that we missed ODAC (Oracle Data Access Components), so we installed the same but still, we didn't get the ODP.Net Managed Data Provider.
We checked the machine.config file from the below path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
When we tried searching for a solution, we got the below link ODP.NET Managed - Unable to find requested.Net Framework Data Provider
Point 11 -- They have mentioned modifying the machine.config file by including ODP.NET, Managed Driver Under section. After modifying the machine.config file, our visual studio got crashed.
As mentioned in the link, we checked with Registry key file and check if RegKey exists or not.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
A managed ODP.NET driver does not show up in Data Source dialogue
But in our system, there is no such folder exists named AssemblyFoldersEx in the specified path.
You missed several information, for example what is in your config file machine.config. Also you did not provide us any error message. Statements as "The above approach didn't work" are not very helpful.
Anyway I will try to give you some hints:
ODAC (Oracle Data Access Components) is a collection of various providers (ODP.NET managed and unmanaged, ODBC, OLE DB). Perhaps you selected the wrong component while installation.
HKLM\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed is not used anymore. Usually the installation script should have deleted it. You Registry should look like this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net]
#="c:\\oracle\\product\\12.2\\odp.net\\bin\\2.x"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net]
#="c:\\oracle\\product\\12.2\\odp.net\\bin\\4"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess]
#="c:\\oracle\\product\\12.2\\odp.net\\managed\\common"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6]
#="c:\\oracle\\product\\12.2\\odp.net\\managed\\common\\EF6"
Of course you have to set folders according to your system.

Visual Studio - The specified store provider cannot be found in the configuration, or is not valid

When trying to build/run a solution that the rest of my teams is using without issues, I keep getting the following error messages.
At runtime it throws exception when instantiating the DbContext: "The specified store provider cannot be found in the configuration, or is not valid"
With an inner exception: "Unable to find the requested .Net Framework Data Provider. It may not be installed"
With the exact same code/project/configuration, 3 other team mates have no issues with this.
We use VS2013, EF 5.0, Oracle Client for .NET, Windows 7 x64
The connection string:
metadata=res://*/BpmModel.csdl|res://*/BpmModel.ssdl|res://*/BpmModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="DATA SOURCE=BpmOracle;PASSWORD=xxxxxxx;PERSIST SECURITY INFO=True;USER ID=xxxxxx;" providerName="System.Data.EntityClient"
So far we have tried:
Uninstalling and reinstalling VS2013
Installing VS2014 Update 4
Created and recreated the solution and workspace about 3-4 times
Entity Framework is installed
TNSNames.ora is correct
Any other things we could try to solve this puzzle?
I've solved the issue.
Switching to a 32-bit application in IIS did the trick.
Details:
Open IIS
Un-twirl the connections list (Most likely the computer name)
Click on Application Pools
For each of the applications listed:
Right click >> Advanced Settings
Set "Enable 30-Bit Applications" to True
Do you have your oracle provider registered in your app.config/web.config in the provider section? Check out this and this for reference.
My solution to this problem was to add the required configuration in Web.config, installing through NuGet the missing package.
Right click your solution or project, click on Manage NuGet packages, and install the missing Oracle reference. This should modify your Web.config with the reference.

Using SQL Server CE 4 on a remote host with MVC 3

I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got:
Sorry, an error occurred while
processing your request.
I see my layout and everything but instead of data I see that.
On localhost is working as expected
I have:
<add name="PruebaContext" connectionString="Data Source=|DataDirectory|db.sdf" providerName="System.Data.SqlServerCE.4.0"/>
as connectionString.
I put the sdf as part of the project, I added the System.Data.SqlServerCE.dll to the project with the local copy to true.
I have no more ideas. The connString, the dll is in /bin and is working in localhost.
Any ideas?
Thanks.
EDIT
I have some logs now:
Without the "System.Data.SqlServerCE.dll" on /bin:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Fine enough. They don't have SqlServerCE4.
With the Dll on local copy, AKA /bin:
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
Exception Details: System.Data.SqlServerCe.SqlCeException: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
The KB says that I need the dll from x86 and amd64. I read somewhere that if I copy two directories to /bin, like: /bin/x86 and /bin/amd64 . I copied that folders from the private folder of SqlServerCE 4 installation folder. Now I got:
Possible file version mismatch detected between ADO.NET Provider and native binaries of SQL Server Compact which could result in an incorrect functionality. This could be due to the presence of multiple instances of SQL Server Compact of different versions or due to wrong binaries with same name as SQL Server Compact binaries. Please install SQL Server Compact binaries of matching version.
Ok. On the root folder of SQLServerCE4 I have some dlls too, so I deleted that two folders and copied that dll to /bin:
Could not load file or assembly 'file:///C:\HostingSpaces\jesusrod\foxandxss.net\wwwroot\mvc3\bin\sqlceca40.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
I think that I tried all things. Scottgu said that SqlServerCE 4 should work on any server without installation.
I don't like to respond to my own answer, but after hours of work I have the answer!
We need:
NuGet (Better than copying the dll's from program file)
With NuGet we install:
EFCodeFirst
SqlServerCompact
EFCodeFirst.SqlServerCompact
The problem was that EF need another dll for SQL CE 4 (System.Data.SqlServerCe.Entity.dll) and we need to put some configuration on web.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
With that, all is working. I have seen like 5 different errors, so we need:
The 2 dll from SQL CE 4, the EF dll, the config in web.config and the native dll (from the package directory where NuGet downloads the library).
It seems that the web.config config is pointing to a concrete version of the SQL CE .dll and the version of the RTM package is different. I can't find the concrete version so I use the .dll from NuGet.
That's all, SQL CE 4 + EF on a remote host.
Just use menu "Project/Add Deployable Dependencies..."
I'm not sure if it is Visual Studio 2010 SP 1 only.
You need to make sure you have the native SQL CE 4.0 dlls in your private application directory (e.g. \bin) in addition to the managed one.
Copy them from "C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Private\amd64" (or x86 if you have a 32-bit app).
It may also be wise to deploy the MSVCR90.dll and it's manifest too. Have a look at the documentation in C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0
for more information about the required DLLs and redistribution.
This looks like a problem that's caused by having multiple intermediate bits of data left in a project, where you've replaced included files without cleaning up.
I'd recommend doing a Build->Clean all, followed by making sure that all of your references are to the new, correct DLLs, and then making sure that none of the old files or references are still around anywhere in your project. Attempt to rebuild once that is done.
Since this is a hello world project, it might be easier to just start from scratch with a new project, and include the correct dlls in there.
try installing SQL CE manually.
http://www.microsoft.com/download/en/details.aspx?id=17876
Good Luck.
I was having the same problem. Trying to put a code-first SQL CE 4.0 app into play on my goDaddy account.
I started messing around with various DLL files based upon the thread above and other tutorials, but nothing seemed to work. Something was missing. Then I read about the Add Deployable Dependencies response.
I did that, which created _bin_deployableAssemblies folder. Then I deleted everything from my bin folder except my core project's DLL and copied everything from _bin_deployableAssemblies into the bin folder.
I cleaned out everything in the bin folder on my goDaddy app and resynced the files. That worked. The app loads and if I make codefirst changes to the classes, the dbcontext recreates the database for me. Of course, I don't want that in production, but I wanted to know that everything was working.
I did try using the ASP tutorial about deploying an MVC app to a hosting environment (they use Cytanium hosting as their example), but it didn't work for me on GoDaddy. I had to copy files manually.
Thanks all. This was a huge step for me being able to feel comfortable continuing in MVC and EF.

SQL Compact 4.0 can't open/read sdf file

I've installed SQL Compact 4.0 CTP 2 via WPI and used NUPack to add SQLCE.EntityFramework in my project.
It compiles and run perfectly but I can't open the SDF file in Visual Studio 2010's Server Explorer.
When I try I always receive the following message:
Microsoft Visual Studio
This is not a valid SQL Server Compact Database file or this file version is not supported by current SQL Server Compact Engine.
OK
I've already tried to uninstall and reinstall everything.
It cannot be opened in SQL Server 2008 R2 Management Studio also.
Please help!!
Installing this (Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0) fixed this exact problem for me perfectly:
http://go.microsoft.com/fwlink/?LinkId=212219
Props to ErikEJ from this thread:
http://forums.asp.net/t/1811963.aspx/1
I met the same problem while trying to follow up the tutorials of MVC3 (MvcMovie) provided by asp.net when I was told to double click the "Movies.sdf" file to check out the tables or other infos.
Acturally the solution is just below the request:
Note If you get an error when you double-click Movies.sdf, make sure
you've installed SQL Server Compact 4.0 (runtime + tools support).
(For links to the software, see the list of prerequisites in part 1 of
this tutorial series.) If you install the release now, you'll have to
close and re-open Visual Web Developer.
After Sql Server Compact 4.0(runtime+tools support) installed, the problem is solved.
This question is a bit old. But I think the answer is that VS2010 SP1 has SQLCE 3.5 and SQLCE 3.5 x64 only, and not SQL Compact 4.0. The SQL products come together with Studio. There is still no SQLCE 4.0 today in 2012 included in distribution of Studio 2010 (I use Express edition).
This version packaging is not direct root cause, but just a clue, that different version will need extra effort.
The fix should involve registration of "Data Provider" in .NET Framework used by Visual Studio.
Look at "DbProviderFactories" inside c:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config. This section describes what data providers can be used by .NET and Studio.
If there is unexpected entries there, try to repair framework or register providers manually. To do so, some low level registration tools will be required. Say for asp.net providers there is aspnet_regsql.exe etc. But for just SQLCE itself there must be something similar.
<system.data>
<DbProviderFactories>
<add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
The difference between broken Studio and working App is that both use the same Framework but have different providers in config. (Or app uses other technique to pick a DLL and open SDF)
Answer: Since SP1 it is officially possible to use SQLCE4.0 in Studio 2010 SP1 (Thanks to Nathan Fisher for link http://support.microsoft.com/kb/983509 )

Visual Studio 2010 Premium is giving me a "Cannot Create Window" error!

When I first launched the Visual Studio (I just installed it) I choose the default programming layout (Visual C#/Visual Basic.NET/ F#/etc) as Web Development. It gave some error that it couldn't find the layout scheme or something and now it says Cannot Open Window.
Is there some way to reset the selected layout option?
I has the same error when I installs MySql Net Connector mysql-connector-net-6.3.4.msi
I think that this installer corrupt my VS 2010. But NOT.
Previous, I uninstall MySql Connector 6.3.2 and edit machine.config... this was the error!
<system.data>
<DbProviderFactories>
<!-- !!! añadido a mano para poderlo usar en VS2010
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net
Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory,
MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> -->
<add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/></DbProviderFactories>
</system.data>
The logic comments not is OK. Then, I erase all commented code and VS2010 come to the live, again!
In my lab the Visual Basic was working fine last semester, but this semester got that "Cannot create the Window" message. After trying reinstalling the VB, Visual Studio, .Net, and other things always got same message. Found a site that mentioned missing windowscodecs.dll file in the windows\system32 directory, but I had the file. Found a different date on file on machines witch the VB was working. Copied the newer windowscodecs.dll file, and that got rid of the problem, but later found I also had to copy the windowscodecsext.dll file as well.
Am now doing a comparison between the two systmes using sigcheck on all the files in system32. Have found a large number that report the Signing date: 12:07 PM 4/14/2008, but the other system has Signing date: 12:13 PM 4/14/2008. Haven't checked the actual contents to see how different the files are. Would be nice if there was a method to check and update to the latest versions.
I've had a similar problem with Visual Studio 2010 Express - restarting the computer solved it.
Similar error message here when starting up a freshly installed VS2010 Premium.
I had copy pasted stuff from old machine.config, but accidentally left out one Section-definition. Fixed by adding the missing definition into configSections-block.
Problem might be due to some issue in machine.config. Try to replace the config with the original and try.
This resolved for me.

Resources