hi i want to use firebird library , and i followed its instruction as below , but i get "The referenced component 'FirebirdSql.Data.Firebird' could not be found." error.
instruction :
Prerequisites
Make sure that you have Visual Studio .NET 2005 Standard or higher edition.
Express editions are not supported.
Registry update
Remember to update the path in FirebirdDDEXProviderPackageLess32.reg or FirebirdDDEXProviderPackageLess64.reg, places where to update it are marked %Path%.
Install the .reg file into the registry.
Machine.config update
Add the following two sections to machine.config (located usually at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config and C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config on 64-bit system).
<configuration>
...
<configSections>
...
<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
...
</configSections>
...
<system.data>
<DbProviderFactories>
...
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=%Version%, Culture=%Culture%, PublicKeyToken=%PublicKeyToken%" />
...
</DbProviderFactories>
</system.data>
...
</configuration>
And subst:
%Version% With the version of the provider assembly that you have in the GAC.
%Culture% With the culture of the provider assembly that you have in the GAC.
%PublicKeyToken% With the PublicKeyToken of the provider assembly that you have in the GAC.
Did you add a reference to the assembly in your project? If not, right click in the solution explorer on references and choose add reference. Find the Firebird client assembly and add it.
Related
I am working on a project using EntityFramework 6.1.1 and npgsql 2.2.3 within Visual Studio 2012 Update 4. To do so I installed npgsl using the supplied setup and installed the nuget packages "Npgsql" and "Npgsql for Entity Framework" (and "EntityFramework" itself, of course).
Every thing used to be fine: I could successfully access my database for a while - until at some day everything "blew up".
This is the event history:
Fixing compiler errors after a major code upgrade I encountered these error messages:
"could not load npgsl.EntityFrameworkLegacy assmbly" (I did neither install nor reference this assembly)
A whole bunch of "Metadata file 'xxx' could not be found" errors where 'xxx' referred to all my own project assemblies
I've found possible solutions the "Metadata file" problems - like deleting the .suo file, checking the project build order and so on. None of them fixed the problem. So I deleted
the .edmx file (and thus all automatically generated database access files) from my project. This fixed the "Metadata file" problems - introducing "unresolved symbols" of course.
I tried to add a new "ADO.NET Entity Data Model" to my project to regain database access. Only all PostgreSQL database connections where not listed any more in the connection list.
Also I could not create new PostgreSQL connections because this data source was not listed. Though this did not affect the global "data connections" dialog within
Visual Studio: here I could still access my PostgreSQL connections.
I reinstalled npgsql using the setup. Now I could create a new "ADO.NET Entity Data Model" and connect to my PostgreSQL database. But this time I'm getting the error message:
"Your project references the latest version of Entity Framework; however, and Entity Framework database provider compatible with this version could not be found [...]". This is
where I am stuck now.
My current setup is:
the project refers to the following assemblies:
EntityFramework 6.1.1 for .NET 4.5
EntityFramework.SqlServer 6.1.1 for .NET 4.5
Npgsql 2.2.3 for .NET 4.5
Npgsql.EntityFramework 2.2.3 for .NET 4.5
This is my app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />
</providers>
</entityFramework>
</configuration>
I have this in my machine.config (both 32bit and 64bit):
<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" support="FF" />
</DbProviderFactories>
</system.data>
Of dourse I tried to rebuild my solution before adding the new model. But this didn't help.
Are there any other configuration issues I may have missed?
Anybody who could explain me my why all this happened at all?
Using Visual Studio 2013, I've added the latest version of ODP.NET Managed to a project using Nuget:
Install-Package odp.net.managed
http://www.nuget.org/packages/odp.net.managed/121.1.2
Now, when I try to run the following code:
Database db = DatabaseFactory.CreateDatabase();
It throws the following exception:
An exception of type 'System.ArgumentException' occurred
in System.Data.dll but was not handled in user code
Additional information: Unable to find the requested .Net
Framework Data Provider. It may not be installed.
After reading of other users's similar issues, I added the Managed driver section to C:\Windows\Microsoft.Net\Framework64\v4.0.30319\Config\machine.config:
<system.data>
<DbProviderFactories><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"/>
<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>
But that had no affect.
I have the connection string specified as such in my web.config, but I'm not sure if it is even looking at the connection string format as it is failing before I open the connection:
<connectionStrings>
<add name="OneCDPBuild"
providerName="Oracle.ManagedDataAccess.Client"
connectionString="Data Source=database;user id=IDhere;pwd=passwordhere;" />
</connectionStrings>
I added the following to my web config:
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<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>
I was getting this error when deploying an ASP.NET MVC 5 application using EntityFramework 5 to our 64-bit server on which the 64-bit version of the ODAC client components were installed.
I followed b_levitt's advise and confirmed that the connection could be opened manually without using the factories, so the ODAC was installed and working, but the factory methods were unable to locate the assemblies.
After pulling my hair for an undisclosed amount of time, I figured out that the problem was with the machine.config file for the 32-bit version of the .NET framework. It did not include the entries for the oracle providers, so I manually added the following entries to this file:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
Under
<configuration>
<configSections>
make sure that you have the following two section entires:
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<section name="oracle.dataaccess.client" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
You can get the exact entries from your machine.config file under the framework64 folder.
Next, under
<system.data>
<DbProviderFactories>
make sure that you have the following two factory names:
<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" />
<add name="ODP.NET, Unmanaged Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Unmanaged Driver" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
After adding these entries, everything was working for me.
I would start by doing a direct test and avoiding the factory methods:
var conn = new Oracle.ManagedDataAccess.Client.OracleConnection("your connection string");
conn.Open();
Any issues here will either be related to the Oracle.ManagedDataAccess.dll missing from the bin directory, or connectivity issues caused by the connection string (assuming you can already connect to the oracle instance via other means).
As for the factory, it looks like you're using some out of date enterprise library code. In later versions of the framework I believe you would use:
var factory = DbProviderFactories.GetFactory("ODP.NET, Managed Driver");
var conn = factory.CreateConnection();
I think if you take it one step at a time you'll get better feedback.
I solved mine changing the IIS Application Pool configuration for Enable 32-bit Application to FALSE.
I was getting the exception Failed to find or load the registered .Net Framework Data Provider because the ODAC I installed is for 64-bit, and my app pool was making the app run at 32-bit.
I'm new on this. I got a sample project that runs perfectly on another pc but get an error when running on my own pc. I changed the connection string and restored the database only. I am using a SQLServer connection, but when I run the project it shows a MySQLRoleProvider error. I searched web.config for this configuration but it isn't there. How can I solve this issue?
The message:
`Parser Error Message: Could not load file or assembly 'MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=+++' or one of its dependencies.
<add name="MySQLRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=***"
connectionStringName="LocalMySqlServer"
applicationName="/"/>`
You need to install the MySQL Connector binaries first for this to work.
http://dev.mysql.com/downloads/connector/net/
If after installation you still face problems, verify that the dll's are declared in machine.config file of the framework version that you're running.
Add following to config file...
<configuration>
<!--Other omited-->
<system.data>
<DbProviderFactories>
<clear />
<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.6.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<!--Other omited-->
</configuration>
I am working on a web app(Asp.Net) and need to draw a chart which is using data from database.
In debug mode, I can retrieve data from database but when try to add chart
chart proporties-> dataSourceId -> SqlDataSource..
connectionstring is ok
Then I get this
The data provide 'FirebirdSql.Data.Firebird.Client' could not be found in the system configuration. unable to find the requested .NetFramework Data Provider. it may not be installed.
Why I am getting this and how to fix it?
Thanks.
This is most probably to do with the version of Firebird. Check your machine.config file for these lines:
Wrong:
<configSections>
<section name="FirebirdSql.Data.FirebirdClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.6.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
What it should be:
<configSections>
<section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
Your machine.config file can be found at these locations (x86 or x64):
32-bit
x:\Windows\Microsoft.NET\Framework\[version]\config\machine.config
64-bit
x:\Windows\Microsoft.NET\Framework64\[version]\config\machine.config
I think you only need to edit the 32 bit version of the machine.config file as VS 2010 is 32-bit only I believe.
Try these things first and hopefully you'll find a fix!
EDIT; try reinstalling Firebird, download the latest version and uninstall all instances of Firebird from your computer beforehand
http://www.firebirdsql.org/en/net-provider/
I'm trying to learn and figure out if it is possible to deploy an MVC, EF, ODAC 11.2.0.3 app to a server that has a previous version of ODP.NET installed. Rather than updating the sever ODP.NET (which I can't), I figured I could use the Oracle Instant Client.
Is this doable?
1) I added these dlls to my project to support Instant Client
-Oracle.DataAccess.dll
-oci.dll
-ociw32.dll
-orannzsbb11.dll
-oraociei11.dll
-OraOps11w.dll
2) Next I updated web.config for the dbProviderFactories
<system.data>
<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.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
3) This (afaik) is how to use the Oracle dll in the bin rathre than the GAC
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" />
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
</runtime>
4) Finally my connectionString
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.DataAccess.Client;
provider connection string="DATA SOURCE=XXX;PASSWORD=XXX;PERSIST SECURITY INFO=True;USER ID=XXX"" providerName="System.Data.EntityClient" />
</connectionStrings>
This is the error I receive
Unable to find the requested .Net Framework Data Provider. It may not be installed.
I really appreciate any help here. I'm rather new and have a lot to learn. Thanks in advance. cheers
Add a <remove … /> section in the <DbProviderFactories> element in the web config to remove any existing Oracle provider. (before the <add>)
<remove invariant ="Oracle.DataAccess.Client" />
It seems from your question that you need to deploy an update to your application and the new version of ODP.net using only xcopy deployment permission.
Since your application is being changed, then you shouldn't need the assembly binding changes or DbProviderFactories.
Just update the csproj of the class library with your edmx etc to have a reference to the new ODP.net version, eg
<Reference Include="Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" />
If you get an issue with your tnsnames.ora, then you would have to do one of the following:
a) Add a system environment variable TNS_ADMIN to point to the directory of the tnsnames.ora, or
b) Change the connection string to something based on:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
c) See if you can put a copy of the tnsnames.ora somewhere else.
Here is my Xcopy solution.
I posted it over at
(https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/#comment-181)
as well.
But I think I can post my xml without formatting issues here.
Nuget "packages.config"
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.0" targetFramework="net35" />
<package id="EnterpriseLibrary.Common" version="5.0.505.0" targetFramework="net35" />
<package id="EnterpriseLibrary.Data" version="5.0.505.0" targetFramework="net35" />
<package id="EntLibContrib.Data.OdpNet" version="5.0.505.0" targetFramework="net35" />
<package id="Unity" version="2.1.505.2" targetFramework="net35" />
<package id="Unity.Interception" version="2.1.505.2" targetFramework="net35" />
</packages>
app.config
(note the <clear /> tag below. this may or may not be needed, but I figured it was better to clear them out since you don't know what may be in the machine.config file)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataConfiguration defaultDatabase="OracleMainConnectionString">
</dataConfiguration>
<connectionStrings>
<add name="OracleMainConnectionString"
connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyOracleServerName)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=MyServiceName)));User ID=MyUserName;Password=MyPassword;"
providerName="Oracle.DataAccess.Client" />
</connectionStrings>
<appSettings>
<add key="ExampleKey" value="ExampleValue" />
</appSettings>
<system.data>
<DbProviderFactories>
<clear />
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description=".Net Framework Data Provider for Oracle" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="EntLibContrib.Data.OdpNet" invariant="EntLibContrib.Data.OdpNet" description="EntLibContrib Data OdpNet Provider" type="EntLibContrib.Data.OdpNet.OracleDatabase, EntLibContrib.Data.OdpNet, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null" />
</DbProviderFactories>
</system.data>
</configuration>
I am developing on a x64 Windows 7 machine.
I downloaded:
ODAC1120320Xcopy_32bit.zip
(from oracle.com)
Which is the:
ODAC 11.2 Release 5 (11.2.0.3.20) Download the XCopy version [Released September 11, 2012]
I unzipped this zip file.
I searched and fished out these files:
oci.dll
Oracle.DataAccess.dll
orannzsbb11.dll
oraociei11.dll
OraOps11w.dll
Note, when there were 2 files of the same name, I took the "bin\2.x\" or "odp.net20\bin" version for my 3.5 Framework need (I'm not on 4.0 yet).
I took these files, and put them in a subfolder from where my .sln file resides.
.\MySolution.sln
.\MyConsoleApplicationFolder\MyConsoleApp.csproj
.\ThirdPartyReferences\
.\ThirdPartyReferences\Oracle\
I place all the files above in the
.\ThirdPartyReferences\Oracle\
folder
I used "Add Reference" to add a reference to Oracle.DataAccess.dll to the "MyConsoleApp.csproj" csharp project.
(This meant browsing to "..\ThirdPartyReferences\Oracle\" of course)
I used a "Post Build Event" to copy the "extra" (aka, "accessory)" files
My lines in my post build event were:
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\oci.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\orannzsbb11.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\oraociei11.dll $(TargetDir)*.*
copy $(ProjectDir)..\ThirdPartyReferences\Oracle\OraOps11w.dll $(TargetDir)*.*
Note, my post build event replaces the "Copy if Newer" from the URL instructions above.
When I ran my project........I got a few missing dll errors.
Note:
In the assembly that has your calls to the EnterpriseLibrary.Data objects…you’ll get “Cannot find Microsoft.Practices.SomethingSomething namespace. Just keep adding references to these dll’s (that the above package.config will pull down) until the errors go away.
Like here is a specific one:
"Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
So (after running Nuget of course, to download all the files)
I went and added a reference to:
\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll
That cleared up the issues.
And my csharp code: (note "select *" is for demo purposes only)
/*
using System;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
*/
public IDataReader EmployeesGetAll()
{
IDataReader returnReader = null;
try
{
Database db = DatabaseFactory.CreateDatabase();
DbCommand dbc = db.GetSqlStringCommand("SELECT * FROM ( SELECT * FROM TEMPLOYEE ) WHERE ROWNUM <= 25");
returnReader = db.ExecuteReader(dbc);
return returnReader;
}
finally
{
}
}
And it worked.
Thank you:
https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/#comment-181
I think this makes ODP.NET an "xcopy" deployment.
I still need to test on a clean machine to be sure.
But its the end of the day..............
================
Additional Information:
Everything above is correct. However, I hit a caveat.
I was using a "Console Application" to test my code.
When you add a new Console Application to visual studio, it DEFAULTS to x86.
As seen here:
http://www.xavierdecoster.com/post/2011/02/15/console-application-visual-studio-gotcha-on-x64-os-aspx
EDIT: (Updated link)
http://www.xavierdecoster.com/post/2011/02/15/console-application-visual-studio-gotcha-on-x64-os
So when I put all the configuration and code and stuff in a real project (which was set to "Any CPU" on a x64 bit machine)...everything I had done stopped working. :<
After tweaking a bit........
I found this file on oracle.com
ODAC1120320Xcopy_x64.zip
I then repeated everything I did above , but searching the unzipped files of this x64 zip file.
Everything is working.
But that "x86" default thing with a Console application threw me for a loop.
I was getting the same error (data provider not found) when deploying ODP.NET via Instant Client. The only thing that I needed to do was to add the following to my exe.config file (inside the tag)
<system.data>
<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.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>