Visual studio 2008 + oracle 18c - c#

I have two applications developed in C# .NET that attacks against an Oracle 10g Database, now the client is planning to upgrade the database to an Oracle 18c. One of the applications is a web application and the other is a desktop application. At this moment I am using Oracle.DataAccess.dll and it is working properly. Will my applications keep working properly after the upgrade or should I recompile my applications with another dll?

It depends on the version of your Oracle.DataAccess.dll. You did not tell us, so please have a look at Client / Server Interoperability Support Matrix for Different Oracle Versions (Doc ID 207303.1)
If your Database is 10.2.0 then Oracle.DataAccess.dll version 11.2 and 12.1 should work, otherwise you have to upgrade your Oracle Client.
Note, version of Oracle.DataAccess.dll has to match exactly the Oracle Client. Installing more than one Oracle Client can be a challenge, better remove old versions completely before you install new one.
In case you will install Oracle Client 12.2 or newer have a look at this: SSMA unable to find specified provider
Usually you don't have to recompile your application. If Oracle.DataAccess.dll is defined in GAC then your application will automatically load the correct version of Oracle.DataAccess.dll driven by GAC Policies.

Related

19C upgrade + framework 4.6.2

I have two applications developed in C# .NET framework 4.6.2 that attacks against an Oracle 10g Database, now planning to upgrade the database to an Oracle 19c. One of the applications is a web application and the other is a desktop application. At this moment I am using Oracle.DataAccess.dll and it is working properly. Will my applications keep working properly after the upgrade or should I recompile my applications with another dll? Or what other configurations required for C# application?
What version of Oracle.DataAccess are you using? The answer depends on it. Are you getting the ODP.NET driver via NuGet?
In theory a 11.2.0.3 client should be able to connect to a 19 database.
Personally, I would ensure that the client driver is at least of version 12.2.

Connecting to Oracle from ASP.NET

I am on a Windows 8.1 x64 machine and trying to connect to my locally installed Oracle 11g database through an ASP.NET WebForms 4 application that I am running from Visual Studio 2013 and IIS Express.
I downloaded ODP.NET from this NuGet package. But I keep getting the error Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format.
Someone please help me troubleshoot this problem. There so little source code and sample out there regarding Oracle and .NET that is up to date.
This usually happens when referencing an assembly that is either 32-bit from a 64-bit application or the inverse. Please make sure you're WebForm project is targeting the same platform as the referenced Oracle assembly.
Quote from the page you downloaded your Oracle.DataAccess.dll:
Oracle will still need to be installed on the production or development machine in order to connect to Oracle (those libraries are greater than 100MB in size, so it didn't make sense to include them in a NuGet package), but this package will at least allow the project to be successfully built
So now you can only build your code, not run it. To run it you should get: 64-bit ODAC 11.2 Release 5 (11.2.0.3.20) for Windows x64 from this Oracle page: http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
Your ASP.NET if installed so after your download and install it run command like this:
C:\oracle\product\11.2.0\client_1\odp.net\bin\4> OraProvCfg /action:gac /providerpath:"C:\oracle\product\11.2.0\client_1\odp.net\bin\4\Oracle.DataAccess.dll"
(assuming your install directory will be C:\oracle\product\11.2.0\client_1\)

ODP.NET: The provider is not compatible with the version of Oracle client

First of all, I want so say I read the other questions and none of them helped me.
The server where I'm getting this error is a Windows 2003 SP2 + .net framework 4.0 + Oracle i9 client
I have downloaded the latest ODP.NET ODAC1120320Xcopy_32bit.zip a copied these dll out.
oci.dll
ociw32.dll
Oracle.DataAccess.dll
orannzsbb11.dll
oraocci11.dll
oraociei11.dll
OraOps11w.dll
I've created a little app which just connects to an oracle. link
And when I run this app I'm getting the The provider is not compatible with the version of Oracle client error.
On the download page was also written : Each 32-bit ODAC client download below supports connectivity to Oracle Database versions 9.2, 10.1, 10.2, and 11.1, and 11.2.
So I guess I should be fine with my 9i database.
I'm not sure if I should use some older ODP.NET version. One answer here on SO sugested to use version 11.1.0.6.20 which supports the .NET 2.0 but my application is written against .NET 4.0.
What can I do ?
I'm unaware of any supported method of running an oracle client without some sort of install (the xcopy version includes a batch file for installation so the "xcopy" is a bit of a misnomer.
That said, if you're going to do something that's unsupported, you might as well go with something that WILL eventually be supported - the 100% managed provider (meaning no extra unmanaged dlls to copy) is currently in beta:
http://www.oracle.com/technetwork/database/windows/downloads/odpmbeta-1696432.html
I am suborn to see something to the end even for just the learning experience so I'd understand if you wanted to see your current way to fruition. The oracle documentation does indicate that the application directory is in fact first in the unmanaged dll search order. My guess is that additional dlls are needed (you are using a newer version than your linked article). I would see which specific dlls it's loading from outside of your app directory using a tool like Process Monitor and see if you can find the equivalents from the new ODAC to copy over.

Accessing an Oracle DB via C# without forcing the user to install an Oracle client

I'm using the oracle.dataaccess.dll when having to query an Oracle DB. But it doesn't work if the user doesn't have an Oracle client installed on his machine. Is it possible to somehow include the Oracle client inside a dll so the user won't have to explicitly install the client?
The managed ODP.net client is exactly what you want. Now that there's a 12c version out, it's a simple single assembly that you can deploy with your application and not have to worry about Oracle installations.
There's also a nuget package that you can use if you don't want to install on your system. That is very painless to get up and running. Here's some links to those:
Main package
Second package to use Entity Framework 6/Code First
You can ship the Oracle Instant Client with your application.
This is a complete Oracle client but it doesn't require installation, it can be used directly.
However, you need to be aware of the following:
The instant client is over 120 MB in size.
You need different versions of the instant client for x86 and x64, bringing the size to about 250 MB.
The advantage of using the instant client is that you don't have to worry about the installed version of the Oracle client. Even if the computer already has an incompatible version installed, your application will work, because it comes with the correct version.
If you're able to pay, I've had fair success with DevArt's DotConnect for Oracle as an alternative to the client provided by Oracle.
It provides a completely managed way of connecting to and querying Oracle, along with Entity framework & nHibernate support and emulation for GUIDs, booleans and a few other datatypes where Oracle lacks support (GUID is raw(16) in Oracle).
All you have to do is ship a single managed DLL with your project.
I finally got it to work by making the Oracle connection string in my app.config and copying all the client DLL's as in this picture:

SMO not available in .NET 4.0? Or is there an easier way to backup a database from code

We upgraded our application to .NET 4.0 a while ago, and now need to add the ability to backup SQL Server 2008 databases from the app. However, it doesn't seem that SMO is available for .NET 4. Is there a workaround or better way to perform a database backup (note that our backups need to be user initiated over a website, so we cannot schedule them).
Use BACKUP DATABASE?
Otherwise, try these One, Two
You can still reference SMO from a .NET 4.0 application, even with it targeting the .NET 2.0 framework.
If you get the Mixed mode assembly is built against version 'v2.0.50727' of the
runtime and cannot be loaded in the 4.0 runtime without additional
configuration information. exception, installing the latest version of the SQL Server SDK (SQL Server 2008 R2) should fix it, even if the machine is running an older version of SQL Server e.g. 2005.

Categories

Resources