connection error when using a DLL in a windows service

connection error when using a DLL in a windows service

Postby devartRR » Sun 22 May 2016 14:31

I am getting the "Cannot load Oracle client. Check your PATH environment variable and registry settings." error when connecting to Oracle in a Windows service via DLL. Here is my scenario-
I have DLL called 'UseDevArt.dll' which uses dotConnect for oracle to connect to my Oracle database. I create a simple exe and use this DLL and every thing works fine. I need to use this DLL in a windows service (third party service so I only have the EXE not the code). The service is open source Quartz.NET schedulng service ( My DLL is used in the service via an interface so I don't need to compile the service with my DLL reference. I have done all the license requirements (included the licenses.licx and licenses.config files in the DLL project according to documentation (

My Service is running under my own account which is admin on the box. But when I run the service I get the PATH env error on the connection.Open(); line! Connection string etc is not the problem because I can run the same DLL in a simple exe with no issues. Here is the code from my DLL

string My_ConnectionString= "Data Source = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEVORA)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = )));User Id=username;Password=mypasswd;";

using (OracleConnection connection = new OracleConnection(My_ConnectionString))
connection.Open(); //this line throws error****************************
//execute commands here

What else do I need? I am really stumped - need help!
Posts: 4
Joined: Tue 02 Jun 2015 06:02

Re: connection error when using a DLL in a windows service

Postby Pinturiccio » Tue 24 May 2016 09:35

Make sure that the user, on behalf of which the service is started, has permissions to access the Path variables and the registry. Also make sure that Oracle Client is installed on a computer.

The bitness of the service and of Oracle Client must be the same. If you want to use the 64-bit application, your Oracle Client must be 64-bit as well. If you want to use the 32-bit application, your Oracle Client must be 32-bit as well.

You also can use the Direct mode. Oracle Client is not required in the Direct mode. For more information, please refer to
Devart Team
Posts: 1860
Joined: Wed 02 Nov 2011 09:44

Return to dotConnect for Oracle