jbator
User
 Fresh Boarder
| Posts: 2 |   | Karma: 0 |
|
instantclient
|
|
Posted: 2005/06/13 08:58 |
|
|
|
|
Hello,
I have maded patch for InstantClient. I'll hope there wil be 1.0.4 so it can be included in it. How it works: Other oracle clients have to be removed from PATH, and env variable ORACLE_HOME have to be set for instantclient dir. I've instant client copied at my application exe directory (ex. c:MyApp) and I'm doing this in C++ code at application startup:
void initOracle() { SetEnvironmentVariable("ORACLE_HOME",AnsiString(ExtractFileDir(Application->ExeName) + "instantclient").c_str()); SetEnvironmentVariable("PATH",AnsiString(ExtractFileDir(Application->ExeName) + "instantclientbin").c_str()); }; //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { initOracle(); Application->Initialize(); Application->CreateForm(__classid(TMainForm), &MainForm);
It also can be done at batch file or in any other place before first connect to Oracle. Also if you don't have tnsnames file at Drive omepathinstantclientnetworkadmin directory you have to set TNS_ADMIN variable for directory where it lays. With this patch and initialization as above I don't need to install anything or change any registry entries so I can install application remotly (with some additional registry entries you can run InstantClient with current ncoci 1.0.3)
Besta Regards
Jacek Bator
diff for NCOci.pas for NCOci 1.0.3 -->
--- Source.orig/NCOci.pas 2004-10-26 13:39:04.000000000 +0100 +++ Source/NCOci.pas 2005-06-10 15:38:56.000000000 +0100 @@ -972,6 +972,8 @@ path: String; reg: TRegistry; + env_oracle_home: String; + procedure InitBest; var sz: DWORD; @@ -982,6 +984,13 @@ SetString(path, nil, sz); GetEnvironmentVariable(PChar('PATH'), PChar(path), sz); path := AnsiUpperCase(Copy(path, 1, Length(path) - 1)); + + sz := GetEnvironmentVariable(PChar('ORACLE_HOME'), nil, 0); + SetString(env_oracle_home, nil, sz); + GetEnvironmentVariable(PChar('ORACLE_HOME'), PChar(env_oracle_home), sz); + + env_oracle_home := AnsiUpperCase(Copy(env_oracle_home, 1, Length(env_oracle_home) - 1)); + end; function TestBestHome(const AKey: String): Boolean; @@ -1024,7 +1033,7 @@ if OpenKeyReadOnly('SoftwareOracleAll_Homes') then begin {$ELSE} if OpenKey('SoftwareOracleAll_Homes', False) then begin -{$ENDIF} +{$ENDIF} s := ReadString('HOME_COUNTER'); if s = '' then n := 1 @@ -1034,7 +1043,13 @@ TestBestHome('SoftwareOracleHome' + IntToStr(i)); end; if FOCIOracleHome = '' then - OCIDBError(msgOCINotInstalled, nil); + begin + if env_oracle_home = '' then + OCIDBError(msgOCINotInstalled, nil) + else + FOCIOracleHome := env_oracle_home; + end; + if FOCIDllName = '' then begin FOCIDllName := FOCIOracleHome + 'BinOCI.DLL'; // single case, than things differs - 8.0.3
|
|