views:

561

answers:

6

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.

+3  A: 

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
+2  A: 

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.

Mac
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
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
+1  A: 

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.

slf
A: 

Mac-

I been reading your posts on here and your site like crazy, cause you seem to be the man I need to speak with.

I am trying to do much the same as the guys here asking you questions, in that I am trying to deploy instant client (trimmed as much as possible) with a ClickOnce-deployed WPF application.

If I understand right there are only 4 files needed (DataAccess, and three Instant Client DLLs you mentioned in another question)...

  1. How do I make them a part of my WPF project/solution so that they are distributed via ClickOnce?

  2. Do I have to do something in my code, or as a supplemental process to make sure they are "installed" once in the proper location? a. I am trying to avoid both PATH and registry tweaks.

Ill check for a reply here, but if you have the time and don't mind... contact me by email.

twhite @ fire . ca . gov

thanks, -T

Those are not all the required files. .DataAccess.dll calls lower level libraries (OCI, etc). It's probably not a good idea to try any minimize the footprint yourself for this one - just take what Oracle gives you in their Xcopy deploy.
Josh Kodroff
A: 

Mac, Josh, and others.

Yeah, I found it was more than 4, because Mac's example was with the 10 instant client. I am using 11.0.6/11.0.7, and it turned out to be about 5 oci*/ora* .DLL files, OraOps11w.dll, and msvcr71.dll (as Mac suggested).

Josh, in order to avoid Path, I used ClickOnce and included these files as Copy Always Content at the root of my application.

My connection string looks like a normal .Net connection string, save Data Source's value looks like what would have been my TNSNAMES.ORA entry.

Works like a charm on XP, but seems like 2003/2008/7 don't like the instant client.

-T

Trey