How can I deploy a .Net Application that uses ODAC to a clean computer with a tsnames.ora file packaged with installer

StackOverflow https://stackoverflow.com//questions/11676389

Question

So here is the problem. This application I have uses ODAC components but I don't want to have to install oracle clients on all the computers the application has to be installed on. So I fallowed this article below:

What is the minimal setup required to deploy a .NET application with Oracle client 11?

The article works well with computers that have some sort of oracle installed or at least tnsnames.ora is in the correct location. However on a fresh machine I receive the error ORA-12645: Parameter does not exist. I have tried packaging the tnsnames.ora along with sqlnet.ora but the .dlls can’t find them. The code below is where the error is coming from:

 g_Db.ConnectionString = "Data Source=(DESCRIPTION= (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=osw-rmoradev)(PORT=1523))) (CONNECT_DATA=(SERVER=DEDICATED)(SID=RML3A))); User Id=RM_Level3;Password="passowrd";"
            g_Db.Open()

Any Ideas on how to package the .ora files will be helpful.

Was it helpful?

Solution 2

It seems by setting the environmental variables for the program instance to the location of the .ora data files seems to have fixed the issue.

nvironment.SetEnvironmentVariable("PATH", "c:\Documents and Settings\" & currentUserName & "\Local Settings\Apps\2.0;" + "c:\Documents and Settings\" & currentUserName & "\Local Settings\Apps\2.0\Data\\R5MG416O.62T\77DKVOW4.TWH\rct...tion_7a1a328dbe52217b_0002.0000_f2dbb34fd1c05e8d\Data;", EnvironmentVariableTarget.Process)
                    Environment.SetEnvironmentVariable("ORACLE_HOME", "c:\Documents and Settings\" & currentUserName & "\Local Settings\Apps\2.0", EnvironmentVariableTarget.Process)

OTHER TIPS

Instead of installing the client, have you tried using the Oracle Data Provider? I remember stumbling upon this project and then not needing to install the Oracle client. Link to ODP

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top