ORA-12557 TNS:protocol adapter not loadable - c#

I am trying to develop a C# Windows Forms Application targeting the .net 4 framework. The program will execute a stored procedure against an Oracle Database and I get the following error when I try to open the connection to the database.
ORA-12557 TNS:protocol adapter not loadable
I am developing this in Visual Studio 2012 and have managed to make the Server Explorer connect to the database successfully, however I keep getting this error through my application.
I have two Oracle 11g clients on my machine. One is 32bit and the other is 64bit. I do need both for different applications so it is not possible to remove one. I have also tried changing the order of the Oracle home directories in the PATH variable. Currently I have the 64bit one first which is the one I would like to connect with.
I am connecting my application to the Database using ODP.NET and have referenced the dll from the 64bit application.
As far as I can tell I have done what has been suggested and have not managed to get it working. If anyone could help it would be appreciated.

The ORA-12577 error is related to Windows Environment or Oracle Home PATH because sqlplus command works smoothly when I execute it inside ORACLE_HOME\bin .
Its because of two or more oracle installs (say database and companion) in separate ORACLE_HOMEs on that machine unset the ORACLE_HOME value in your window
For Details please follow the following steps and hope so you will get the solution.
http://www.dba-oracle.com/t_ora_12577.htm

The base problem is that there are DLLs missing in the Oracle instant client installation that exist in the RDBMS server installation that the application requires. This is why switching Oracle homes from client_1 to db_1 works, rather than it being a purely a PATH problem.
sqlplus works in either situation because it uses the minimal set of DLLs which exist in both Oracle installations.

Here are a few things to check. Dont forget to try #3 if needed, it fix the problem for me!
Make sure all Oracle services are started
Make sure environment variables are set (PATH, ORACLE_SID=ORALOCAL, TNS_ADMIN=C:\Dev\Oracle\product\11.2.0\dbhome\NETWORK\ADMIN)
Try shifting the Path environment variable values like so:
“D:\Dev\Oracle\product\11.2.0\dbhome\bin” to be before the
“D:\dev\Oracle\product\11.2.0\client_32\bin” in the order
Fissh

For me I am using IIS .net provider. I was able to fix the problem with sqlplus by putting oracle64 before oracle32 in the path. This did not fix problems with .net. I have apps that use oracle32 and oracle64. To solve this problem registry keys HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE must point to \oracle32 home and HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE must point to the \oracle(64) home.

Related

How to get SQLite up and running in Visual Studio?

I'm having major issues trying to connect an existing SQLite database to my C# application. I've installed SQLite bundle for 32 and 64 bit, I've installed SQLite/SQL Server Compact Tools extension, installed SQLite dlls into GAC, added various different provider tags suggested by dozens of blog posts to my app.config, to my 32 bit machine config, to my 64 bit machine config. Does anybody know just what exactly does one have to do to make Visual Studio let me hook up my SQLite DB to my application?
I'm trying to add a new ADO.NET Entity Data Model to my application by using the option "EF Designer from database". I'm either getting hit with "Unable to find the requested .Net Framework Data Provider" and Visual Studio cannot even find my DB in the dialog (even though I can see it in the Server Explorer).
Or, after I've installed an additional ADO.NET SQLite as VS extension, I can see my SQLite database and test connection is sucess ful, but a soon as hit the Next button I get this:
I've installed EF only through the System.Data.Sqlite NuGet package, I'm maximally confused about this whole provider business.
Please HELP! Thanks!!!
Ok, by following a provided helpful link to a detailed guideline I was finally able to get everything up and running. I've done exactly what's described here: https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider
However I'm taking the liberty of providing some additional tips for anybody stumbling over the same issue.
I'm still confused about what machine config to manipulate (VS is 32 bit but I'm developing a 64 bit application), so I manipulated both without trying which one matters in that context.
The duplicate closing tag for the DbProviderFactories in the
machine config that's desribed in the mentioned github page as well
as in numerous other blogs might not always be the problem and was
not the case on my machine. But if you encounter it, clean it up
anyway.
If you apply the described changes, double check to make sure that you yourself do not introduce new duplicate tags, otherwise your Visual Studio will start up with an unusual looking start page and crahs, after fixing it all of your pinned editor and tooling windows will be gone and you'll have to re-arrange everything!
Your existing SQLite database (even if visible in the Server Explorer) might still not show up in the Choose Your Data Connection section of the Entity Data Model Wizard after hitting Next.
In that case just select New Connection..., Continue, enter your connection string there into the mask and test the connection before hitting OK. Then your database should be selected and it should work.
In case you don't know the connection string of your SQLite database, but managed to get it into the Server Explorer, you can get it by right clicking and selecting
Properties in the Server Explorer, it will show up in the Properties window.

How to deploy an EntityFramework application in a intranet?

I have deployed a Windows Forms Application (Visual Studio 2013 C#) to a file share and will get my users to run the app from this file share. The app uses Entity Framework 6 and works fine from the file share but there is a delaying in loading the EntityFramework.dll during execution for the first time.
Is it possible to move just this dll from the file share to the local pc and tell the app to use it from the local pc?
As #tede24 stated, before trying to solve this problem, make sure EntityFramework.dll is actually your problem.
Once you make sure it is, here are the options I can think of:
1) Use ClickOnce
ClickOnce is not popular, but it still seems to be the preferred way for deploying intranet applications. Yes, it supports version checking and auto updates.
2) Use some sort of XCopy installation
You can create a batch/PowerShell to copy the application content locally from your intranet. If you want to go futher, you can even verify whether the version is the latest before launching.
3) Try putting EntityFramework in the GAC on the client machine (not recommended)
EntityFramework is not meant to be GACed, but you can still try to do that. I would strongly avoid it because of dependencies and update problems you might run into.

Error System.Data.OracleClient requires Oracle client software version 8.1.7 or greater when installs setup

I have made a desktop app Setup that connects with remote Oracle 10g Database. When I install Setup on remote machine and run my application then I get following error:
system.data.oracleclient requires oracle client software version 8.1.7 or greater
It works well on my Development machine.
It is a security issue, so to fix it simply do the following:
Go to the Oracle Client folder.
Right Click on the folder.
On security Tab, Add "Authenticated Users" and give this account Read & Execute permission.
Apply this security for all folders, Subfolders and Files (IMPORTANT).
Don't Forget to REBOOT your Machine; if you forgot to do this you will still face the same problem unless you restart your machine.
http://blogs.msdn.com/b/fabdulwahab/archive/2011/11/13/system-data-oracleclient-requires-oracle-client-software-version-8-1-7-or-greater.aspx
The error message is pretty self-explanatory: your application needs the Oracle Client installed on the machine it's running on. Your development PC already has it. Make sure your target PC has it, too.
Edit: The System.Data.OracleClient namespace is deprecated. Make sure you use the driver native to your database system, that would be ODP.NET from Oracle.
Install Nuget for Oracle.ManagedDataAccess
Make sure you are using header for Oracle:
using Oracle.ManagedDataAccess.Client;
This Worked for me.
On your remote machine, System.Data.OracleClient need access to some of the oracle dll which are not part of .Net. Solutions:
Install Oracle Client , and add bin location to Path environment varaible of windows
OR
Copy
oraociicus10.dll (Basic-Lite version) or aociei10.dll (Basic version),
oci.dll, orannzsbb10.dll and oraocci10.dll from oracle client installable folder to bin folder of application so that application is able to find required dll
On your local machine most probably path to Oracle Client is already added in Path environment variable to there required dll are available to application but not on remote machine
If you have to use the older client, here is my experience.
We are running a 32bit server so the development machines run the 32bit client. We run the 11.1 install, 11.2 gets the error. Once you have installed the 11.2 version you have to manually delete the files Oracle.Web.dll and System.Data.OracleClient.dll from the %windir%\Microsoft.NET\Framework\v2.0.50727, reinstall 11.1, then register the dlls with gacutil.exe.
This fixed the issue with my systems.
Go to C:\app\insolution\product\11.2.0\client_1\BIN and find oci.dll. Right click on it -->Properties -->Under Security tab, click on Edit -->Then Click on Add Button --> Here add two new users with names IUSR and IIS_IUSRS and give them full controls. That's it.
After installation of Oracle Client 11.02.04, reboot the server and make sure USERS(Local Computer) is added with Full Control on Root folder for eg WWW
Tested, it worked.
This posting is about mostly desktops and this oracle message. I want to talk about server class machines running a dtexec that are throwing this error message. In one case it meant that an installed oracle client instance on a server machine was no longer there, and it had been there for a long time. On the client side we found recently 1/2023 that certain versions of the oracle client 32 bit don't run on a laptop with AMD chips. Downgrading to a lower version of the oracle client 19.x fixed the problem.

"Required permissions cannot be acquired" while debugging standalone application

I'm trying to debug a native application that uses some C# components but I'm getting a "Required permissions cannot be acquired" error when trying to start the application.
Now I did search StackOverflow and the net in general but all answers that I could find were related to ASP Web applications but the one I'm trying to debug is a standalone one.
Additional background: I'm using WinDbg to debug code that runs in a remote machine via remote terminal (in fact by using TWO remote connections since the machine in question is not reachable from my machine directly thanks to some stupid router configuration). The binaries are located on my computer and I access them via the auto drive mapping that RT does for me.
Now I did have similar issues in the past and I'm pretty sure that the code would run if I copy all the binaries to the target machine and start them from a local drive but this is something that I want to avoid.
NOTE: The code is targeting version 2.0 of the .Net Framework. The target machine does not have the configuration tool for .Net 2 installed and I gave up trying to install and make it run by hand to try to see if there is some "trust" setting that I can set to mke the code run..
Problem turned out to be a firewall issue and related to the fact that I could not reach the target machine (where the program was running) directly from my PC (where the executable files where located). I was connecting indirectly through another PC to the target machine and this was causing problems with the .Net security checks, after changing the switch/firewall so that I could connect directly I had no more problems.

C# MySQL Connector works in IDE, not after publish?

For some reason I can't seem to get the MySQL Net Connector to work with C# outside of the IDE. I have a very simple program working just fine in the IDE (connecting to the database and everything) but when I publish the code and run the .application file (on my local computers desktop or off the company server) it says it can't connect to any of the specified MySQL hosts.
Any help would be greatly appreciated! :(
Thank you
I would double check all your references, and make sure you have the MySQL Net Connector in the GAC.
Check that the MySQL provider is properly declared in the machine.config file (in the DbProviderFactories element). You can also declare it in the web.config instead

Categories

Resources