connection error when using a DLL in a windows service
Posted: 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 (http://www.quartz-scheduler.net/). 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 (https://www.devart.com/dotconnect/oracle/docs/).
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 = DEVORA.internal.myCorp.com )));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!
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 (http://www.quartz-scheduler.net/). 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 (https://www.devart.com/dotconnect/oracle/docs/).
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 = DEVORA.internal.myCorp.com )));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!