Setting Up an Oracle Database Instant Client

To set up the Oracle Database Instant Client, you must:

  • Install the Oracle Database Instant Client and its ODBC driver on your system;
  • Set the TNS_ADMIN environment variable;
  • Configure atnsnames.ora configuration file for your client.

To install the Oracle Database Instant Client:

  • Download the Oracle Database Instant Client from the Oracle web site. You will need the Basic and ODBC Supplement packages. Place these packages in a folder or directory on your computer (such as C:\Oracle).
  • Unzip the packages that you have downloaded. The unzipped files will be copied into a subdirectory named instantclient_X_Y, where X and Y represent the version number of the Oracle Database Instant Client (for example, C:\Oracle\instantclient_11_1).
  • Open a Command Prompt window, and set your current directory to be the instantclient_X_Y directory into which the unzipped files have been copied.
  • Type odbc_install. This will install the ODBC driver on your system:
odbc_install

The next steps are to ensure that the necessary Windows environment variables are defined. You will need to:

  • Create an environment variable named TNS_ADMIN, and set its value to be the directory that contains the Oracle Database Instant Client (for example, C:\Oracle);
  • Ensure that the directory that contains the Oracle Database Instant Client is included in the PATH environment variable.

To define the necessary environment variables:

  • From Windows, open the Control Panel and click System.
  • Click the Advanced tab.
  • Click Environment Variables.
  • In the System variables panel, click New.
  • In the Variable Name field, type TNS_ADMIN.
  • In the Variable Value field, type the name of the directory that contains your Oracle Database Instant Client (for example, C:\Oracle).
  • Click OK to create the environment variable. The Environment Variables window is now displayed again.
  • In the System variables panel, locate the variable named Path or PATH. (If it does not exist, create it using the steps that you used above to create TNS_ADMIN.)
  • Select the PATH environment variable, and click Edit.
  • In the Edit System Variable window, in the Variable Value field, position your cursor at the end of the current list. Append a semi-colon ; to the list, then type the directory that contains your Oracle Database Instant Client.
  • Click OK to close the Edit System Variable window.
  • Click OK again to close the Environment Variables window.
  • Click OK to close the System Properties window.

Next, you must create a tnsnames.ora configuration file for your Oracle Database Instant Client. This file should be located in the directory in which your Oracle Database Instant Client is installed (for example, C:\Oracle). The tnsnames.ora file should look like this:

MY_ORACLE_SOURCE =
(DESCRIPTION =      
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT =     portnum))
  ) (CONNECT_DATA =
  (SID = XE) (SERVER = DEDICATED)
  )
)

In the definition shown above, replace MY_ORACLE_SOURCE with the name of your Oracle data source, replace hostname with the host name for your Oracle server, and replace portnum with the port on which your Oracle server is running.

The final step is to create a file named sqlnet.ora, located in the same directory as tnsnames.ora. In this file, add the following line:

TCP.CONNECT_TIMEOUT=5

This tells the Oracle client to time out if a connection to the Oracle server cannot be obtained within 5 seconds. (The default is to never time out, which can cause problems if the server is down or cannot be reached.)

Your Oracle client is now ready for use as an ODBC data source. See Setting Up an ODBC Data Source for Oracle for information on how to set up an ODBC data source for Oracle, and see Using an ODBC Oracle Data Source for information on how to use this data source in an Iguana channel.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末陋气,一起剝皮案震驚了整個濱河市脯丝,隨后出現(xiàn)的幾起案子旅薄,更是在濱河造成了極大的恐慌剿另,老刑警劉巖,帶你破解...
    沈念sama閱讀 211,123評論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件蔚龙,死亡現(xiàn)場離奇詭異讯泣,居然都是意外死亡琼娘,警方通過查閱死者的電腦和手機蕴侧,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,031評論 2 384
  • 文/潘曉璐 我一進店門择同,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人净宵,你說我怎么就攤上這事」桑” “怎么了择葡?”我有些...
    開封第一講書人閱讀 156,723評論 0 345
  • 文/不壞的土叔 我叫張陵,是天一觀的道長剃氧。 經(jīng)常有香客問我敏储,道長,這世上最難降的妖魔是什么朋鞍? 我笑而不...
    開封第一講書人閱讀 56,357評論 1 283
  • 正文 為了忘掉前任已添,我火速辦了婚禮妥箕,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘更舞。我一直安慰自己畦幢,他們只是感情好,可當我...
    茶點故事閱讀 65,412評論 5 384
  • 文/花漫 我一把揭開白布缆蝉。 她就那樣靜靜地躺著宇葱,像睡著了一般。 火紅的嫁衣襯著肌膚如雪刊头。 梳的紋絲不亂的頭發(fā)上黍瞧,一...
    開封第一講書人閱讀 49,760評論 1 289
  • 那天,我揣著相機與錄音原杂,去河邊找鬼印颤。 笑死,一個胖子當著我的面吹牛穿肄,可吹牛的內(nèi)容都是我干的年局。 我是一名探鬼主播,決...
    沈念sama閱讀 38,904評論 3 405
  • 文/蒼蘭香墨 我猛地睜開眼被碗,長吁一口氣:“原來是場噩夢啊……” “哼某宪!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起锐朴,我...
    開封第一講書人閱讀 37,672評論 0 266
  • 序言:老撾萬榮一對情侶失蹤兴喂,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后焚志,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體衣迷,經(jīng)...
    沈念sama閱讀 44,118評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,456評論 2 325
  • 正文 我和宋清朗相戀三年酱酬,在試婚紗的時候發(fā)現(xiàn)自己被綠了壶谒。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,599評論 1 340
  • 序言:一個原本活蹦亂跳的男人離奇死亡膳沽,死狀恐怖汗菜,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情挑社,我是刑警寧澤陨界,帶...
    沈念sama閱讀 34,264評論 4 328
  • 正文 年R本政府宣布,位于F島的核電站痛阻,受9級特大地震影響菌瘪,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜阱当,卻給世界環(huán)境...
    茶點故事閱讀 39,857評論 3 312
  • 文/蒙蒙 一俏扩、第九天 我趴在偏房一處隱蔽的房頂上張望糜工。 院中可真熱鬧,春花似錦录淡、人聲如沸捌木。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,731評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽钮莲。三九已至,卻和暖如春彼水,著一層夾襖步出監(jiān)牢的瞬間崔拥,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,956評論 1 264
  • 我被黑心中介騙來泰國打工凤覆, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留链瓦,地道東北人。 一個月前我還...
    沈念sama閱讀 46,286評論 2 360
  • 正文 我出身青樓盯桦,卻偏偏與公主長得像慈俯,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子拥峦,可洞房花燭夜當晚...
    茶點故事閱讀 43,465評論 2 348

推薦閱讀更多精彩內(nèi)容