1

I have an application that's using Oracle.DataAccess to connect. I've already discovered that the footprint can be lessened by using ODAC 11 with xcopy deployment. That's already a big win.

Ideally, though, we would like to not have to alter any path variables and have all the ODAC files in a subdirectory underneath the application's folder. Is it possible to do this without changing the PATH variable? Is there some way to set a temporary PATH variable? Could we copy all of the files necessary to the application folder?

The general idea is that we want to isolate our ODAC files as much as possible from other applications that might be running on the same client.

Josh Kodroff
  • 27,301
  • 27
  • 95
  • 148

5 Answers5

4

System.Environment.SetEnvironmentVariable allows you to modify the process environment block. Whether that's enough for notoriously PITA Oracle is anyone's guess, though. ;)

Mark Brackett
  • 84,552
  • 17
  • 108
  • 152
3

As Mark suggested, you can always have your application change the environment variable for the current process. Note that, obviously, you'll have to do it before any ODP .NET call is made.

Also note that if you only need pure ODP .NET features, by which I mean you specifically don't need :

If you are in this case, you can only distribute Oracle Instant Client with your application. See this question for more details.

Community
  • 1
  • 1
Mac
  • 8,191
  • 4
  • 40
  • 51
  • Many thanks for this comment. As it turns out, our app does need ODBC connectivity for a third party component. I'm woefully ignorant of ODBC. Is there an MS-supplied provider for Oracle? Do you happen to have any experience with how it performs? – Josh Kodroff Apr 09 '09 at 15:00
  • The MS providers for Oracle (ODBC and OLE DB) are part of the MDAC (http://www.microsoft.com/downloads/details.aspx?familyid=78CAC895-EFC2-4F8E-A9E0-3A1AFBD5922E), but they need an Oracle client. So you'll have to change your PATH after all... At this stage, I'd go with the full ODAC. – Mac Apr 15 '09 at 09:13
2

Changing the Environment variable is a sweet hack, but just for academic completeness I think embedding assembly resolving is actually the 'proper' way to solve this problem, even if it is more code.

Community
  • 1
  • 1
slf
  • 22,595
  • 11
  • 77
  • 101
0

Yes you can, see http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html for details.

ObiWanKenobi
  • 14,526
  • 11
  • 45
  • 51
0

As was mentioned earlier, this StackOverflow question talks about how one might accomplish your goal. This answer is quite good. I commented on that answer that I was able to use an Easy Connect connection string and use the same binary on my production machine and my development machine by simply copying the Instant Client Lite DLLs and Oracle.DataAccess.dll to the application folder on the production machine. On my development machine I have the full Oracle Client installed. This way there is no need to modify path statements at all.

Community
  • 1
  • 1
cjbarth
  • 4,189
  • 6
  • 43
  • 62