SQL1159 Initialization error with DB2 .NET Data Provider, reason code 2 - c#

I am trying to connect to DB2 from .NET 2.0 application in my development machine running windows 7 64 bit.
I am getting this error in open method. Could not find a solution.
ExceptionType: InvalidOperationException
ExceptionMessage: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 2, tokens D:.......................\bin\db2app.dll,
StackTrace: at IBM.Data.DB2.DB2ConnPool.Open(DB2Connection connection, String& szConnectionString, DB2ConnSettings& ppSettings, Object& ppConn)
at IBM.Data.DB2.DB2Connection.Open()

Learnt this from a colleauge of mine. Issue was because db2app.dll was missing in bin directory of application folder.
Copied db2app.dll and db2app64.dll from C:\Program Files\IBM\SQLLIB\BIN to bib folder of application and it worked fine.

See the "user response" at the bottom of the IBM doc for SQL1159N, which also lists the various reasons you might receive this error code:
There was a problem with your DB2 installation. If this is the first time DB2 was installed on this computer, review the install logs for any possible errors and run a repair of DB2 from the Add/Remove Programs control panel applet. The default location of the installation logs is the My Documents/DB2LOG folder of the user that performed the installation. If this does not resolve the issue please contact IBM Support and provide the reason code associated with this message along with any installation logs.

I had a 32 bit DB2 Client and I was accessing it from a Web Application hosted on IIS, using Application pool (with 'Enable 32-bit Application' set to false). In this case a
64 -bit client (db2app64.dll)
is expected while db2app.dll will throw above error.
Just FYI..
It is hard to debug this error in Visual studio as by default IIS express uses 32-bit application pool. To change it to 64-bit, one has to make changes in registry (set Use64BitIISExpress to 1) There is no inetmgr for IIS Express.

After speaking to IBM, they recommend strongly against putting IBM dlls inside the bin folder. We let IBM remotely configure our server and now all works well and we must not put the ibm*.dll into our bin folders or it will not work.

Related

Updating Oracle 12.1 to 12.2 Oracle Dependency Error occurs

We have recently been struggling to update our C# applications with the new Oracle DLLs. We create our software for multiple platforms. So our software solution is both a winform desktop application and a ASP.NET MVC webapplication.
Both applications run Oracle 12.1 stand-alone perfectly. We add all necessary Oracle DLLs with the redistribution of our software. So the desktop application has all the DLLs within the MSI and the publish of the website has all the DLLs in the ~\Bin. Making sure that when the website is hosted on IIS the web application runs. This way our customers do not need to install Oracle Client.
Now comes the problem, since updating to Oracle 12.2 it's not possible for us to run the web application any more. The desktop application still runs fine although since Oracle 12.2 we get a Firewall Exception message, if we want to allow our desktop application to connect to the internet.
We didn’t get that message in Oracle 12.1 or below:
We have published our webapplication with all the new Oracle dll’s (the same dll’s as desktop and the same way as for when the webapplication has Oracle 12.1) and since then we are not able anymore to connect to our Oracle databases. We get the error below:
Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String version)
at Oracle.DataAccess.Client.OracleInit.Initialize()
at Oracle.DataAccess.Client.OracleConnection..cctor()
--- End of inner exception stack trace ---
We have checked, but YES the DLL is there. We also put it in different locations to see if this would work but no.
These are the DLLs we are using:
The strange thing is that when we copy our desktop application to the server, the desktop application runs fine! The desktop application has the exact same DLLs as the web application!
The DLLs we are using for both desktop and web application are from the XCopy folders of Oracle:
http://download.oracle.com/otn/other/ole-oo4o/ODAC122010Xcopy_32bit.zip x86
http://download.oracle.com/otn/other/ole-oo4o/ODAC122010Xcopy_x64.zip x64
There are more people struggling with this issue, here is what we have found so far:
Oracle 12.2 needs minimum .NET Framework 4.5.2 our server has 4.6 and up
The rights of the DLLs are set correctly and may be used by IIS
We have for our x86 web application enabled 32-bit application in the Advanced Settings window
We have set the environment making sure the right DLLs are added to the environment
In Visual Studio we made sure that the references are: Copied if newer and Local copy is set to true
Our application are full x86 or x64 NOT anyCPU build.
We have checked our Regedit, Machine.config and GAC for any possible left-over of other Oracle versions.
Redownloaded the xcopy zip and copied the files again
Server has DISABLED firewall (development)
Oracle.DataAccess.Client Dependencies this is more or less our method to!
Our server-specs:
Windows Server 2012R2 DataCenter (clean)
X64-based pc
using IIS 8.5
This way our customers do not need to install Oracle Client.
I think this is a bad idea, I do not recommend doing it like this.
Either
Ask your customer to install Oracle Client (include ODP.NET provider) by themselves using standard Oracle downloads
or
Use the ODP.NET Managed Driver, then you don't need any further installation. You just have to provide the Oracle.ManagedDataAccess.dll with your application.
It it hard to determine your problem without further information, there could be several reasons:
Missing DLL -> For this I cannot help you, make a normal Oracle installation
Wrong PATH settings. -> Ensure %ORACLE_HOME% and %ORACLE_HOME%\bin are in
How did you check your GAC? Did you usegacutil.exe version 4.0? Older version 3.5 does not show 4.0 (and above) assemblies.
You may have a conflict with 32-bit vs. 64-bit Oracle installation. In case you need both of them, follow this installation instruction: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed
Version of ODP.NET does not match with version of installed Oracle Client. The major release (e.g. 11.1, 11.2, 12.1, 12.2) has to be the same for both.
You can also use Process Monitor tool, in order to see which DLL and/or registry entry is missing.

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.

Getting the error "The 'VFPOLEDB.1' provider is not registered on the local machine" even after installing and registering the provider

Alright, so I've got a Windows service that has a FileSystemWatcher that watches an output folder for some Visual FoxPro database files. And it leverages the VFPOLEDB.1 provider to read those files. I cannot go away from this provider because it's being used in production.
However, I've never had to support this application before so that's why my development box isn't setup for it. Here is my environment:
Windows 7 x64
Visual Studio 2005
.NET 2.0 Windows service
so, when I first started getting the error I figured I just didn't have the provider at all, and I was right. So, I downloaded and installed it from here.
I then proceeded to drop the files in the folder again, but I got the same error.
I figured because it's an x64 machine I might be experiencing problems with it getting registered since it was probably dropped into SysWOW64, and it was as I expected, so I ran this command:
regsvr32 "C:\Windows\SysWOW64\mscomct2.ocx"
and it said it was successfully registered (which means about nothing LOL) but I dropped the files in again - same error.
I have not yet rebooted my machine, and I can if somebody has a compelling reason that's the problem, but generally speaking if the assembly is registered properly with regsvr32 that's not necessary. I've worked with a ton of COM objects and never have to reboot to get to the object as long as I've registered it.
Does anybody know another step I need to perform to get this thing registered?
It is registered as it should. It is your application that is compiled for AnyCPU Platform.
In x64 operating system this produces 64bit code and 64bit code could not access 32bit drivers.
Change your Platform to x86 and you will be fine.
EDIT
Two years later there is something to add to this answer. Now with Visual Studio 2013 the cheese has been moved. The article linked explain in great details how the compiler setup defaults has been changed. The AnyCPU target CPU with Prefer 32 bit means that your application works as 32bit app also in x64bit operating systems leaving practically no-room to x64 application unless specifically required.
With this new configuration becomes also important to remember what is posted in comments below by Mark Berry. If your (now 32bit) app needs to work in a IIS 64bit environment you need to set the Application Pool with Enable 32 bit Applications
I have desktop app (Win7 x64 VS 2015) - and kept getting the same error no matter what. I changed platform target to x86, installed MSI as admin etc - did everything I could google - and no luck. What helped me is to install MSI for Everyone instead of Just me - one of the last wizard's screen in the setup.
I have the same problem.
I install the VFP Ole DB Provider in my system and resolved.
download link
use Advantage OLE DB Provider,works for 32 or 64,here is the connection string

Include ACE OLEDB 12 driver as part of a clickOnce install

I have developed a C# winform application in Visual Studio 2010 that connects to a Access 2010 *.accdb database. It works fine on my pc but when I install it on another, It throws the error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."
I tried to compile it to x86, as advised, without any succes.
Any help/advice is appreciated, I think that I should include this driver as part of my clickOnce install. If so, how do I do so? (It does not appear as an option in the checklist of requirements, in VS Properties > Publish > Previous requirements)
You will have to use a more advanced method of deploying the necessary driver - ClickOnce won't do it by itself as far as I know. I also don't think it's as simple as a single DLL. The driver needs to register with the system etc.
There is a big issue with the Access drivers because of the way they are set up. If the user has Microsoft Office with Access installed, they will already have the ACE driver. The problem is, if they have 32 bit Access installed on a 64 bit machine, your 64 bit application will not be able to talk to Access because the machine only has a 32 bit driver, and you cannot install both.
If none of your users have Microsoft Office with Access, then you should be able to deploy the standalone driver installer for 32/64 bit as necessary with each computer.
It is possible to include arbitrary assemblies and files as part of your ClickOnce install by adding them to the project and changing their file type to Content. They will then appear in the list of Application Files.
Note that you'll get a warning from Visual Studio if you do this, but it can be safely ignored.
You can build an msi instead of oneclick and create a custom action that would install ace driver in quiet mode. Since its an executable you can just run it in a process object

.NET C# running application from UNC results in error

I have an application which does not read ANY files from the local disk or does not try to write anything.
It runs perfectly on the local filesystem, but it needs to run on a few 100 workstations, so I put it on a share on a Win2003 server.
But when I try to start it on a XP workstation from the UNC:
system.io.fileloadexception
What can be the issue here?
The issue is that the XP machine is likely running an earlier version of .Net 2.0. Up until 3.5 SP1 it was a violation of CLR security policies to run a .Net application from an UNC share. To do so you must tweak the CAS (Code Access Security) policy on the local machine. Starting with 3.5SP1 this requirement was removed.
More Details:
http://geekswithblogs.net/robz/archive/2008/08/19/.net-framework-3.5-sp1-no-more-need-for-caspol-on.aspx
Only applications on the local file system have full trust to run. Try following the steps on this site:
http://dotnetdud.blogspot.com/2009/01/how-to-give-file-share-fulltrust.html
.Net code access security might be one of reasons. You can adjust it in thru control panel and change the settings for "Local intranet" zone. The best solution is to create a custom policy, however.
it is because of limited permissions. as far as i remember, if you go to explorer and find that exe, right click on it, you will see tab for extending permissions for app.

Categories

Resources