Connecting to Oracle(转)

(转自http://www.querytool.com/help/911.htm)

These notes were written for Oracle Version 9 and Version 10g. The names of the Oracle products, and how they are packaged, can be different for different releases of Oracle.

Prerequsite Software

In order to connect to an Oracle database, you need to install the Oracle Client or Instant Client on your PC.

In addition to this, you need an Oracle ODBC Driver. You will have a choice of:

  • the Microsoft-supplied ODBC Driver for Oracle. This comes as part of the standard Windows install.
  • the Oracle-supplied ODBC Driver. This comes as an optional part of the Oracle Client install. When installing the Oracle Client you need to do a Custom install; the ODBC Driver will be part of the Oracle Programmer component.

While AQT works with both ODBC Drivers, we strongly recommend that you use the Oracle ODBC Driver. The Microsoft ODBC is limited in functionality. Principally:

  • Large objects (BLOBs, CLOBs) are not supported
  • Unicode data cannot be displayed
  • A query using the WITH clause will not display any data

Oracle Net Configuration

To configure a connection between your PC and an Oracle server you need to run the Oracle Net Configuration. Once you start this, select Local Net Service Name configuration then Add. You will be asked the following information:

  • Service Name. This is the global database name for your database. Your DBA will know what this is.
  • Communication Protocol. Use TCP.
  • Host Name. Enter the IP address or host name of the machine on which the Oracle server resides. Use localhost if the database resides on your own machine.
  • Port Number. The default port (1521) will generally be the correct value. However it is possible that your DBA has configured Oracle to use a different port; check with him/her.
  • Net Service Name. This is the name you give for this connection. A good standard is to give it the same name as the Service Name.

Once you have configured this connection, you will be able to access your Oracle database using SQL*PLUS.

ODBC Driver Configuration

In order to access your Oracle database using AQT, you will need to configure an ODBC Datasource for your database. The general process for doing this is described in Configuring a Database Connection.

To configure this, specify:

  • Data Source Name. The name you give this ODBC datasource.
  • Description. Not used. Leave blank.
  • User Name. Not used. Leave blank.
  • Server (Microsoft ODBC Driver). The Net Service Name as configured in Oracle Net Configuration. This is the name you use when you sign onto the database using SQL*PLUS.
  • TNS Service Name (Oracle ODBC Driver). As with Server above.

With the Oracle ODBC Driver, it is a good idea to click on Test Connection to check that the connection has been set up correctly.

In addition (for the Oracle ODBC Driver)

  • on the Oracle tab, ensure that Enable LOBs is checked. If this is not checked, you will be unable to insert LOB columns successfully.

Installing the Oracle Instant Client

To install this, you need to download two packages:

  • Client Package - Basic
  • Client Package - ODBC

We found that the "Client Package - Basic Lite" did not work for us.

Follow the instructions to install the products, and to install the ODBC Driver. You will also need to:

  • change your PATH environment variable to include the directory containing SQORA32.DLL
  • set up a tnsnames.ora file. This can be placed either in the same directory as the Instant Client or some other directory. The Instant Client provides no means to configure the tsnames.ora file (which contains the Oracle network names). The easiest way to create tnsnames.ora is to set it up on a machine that has the full client then copy it across.
  • set environment variable TNS_ADMIN to the directory containing tnsnames.ora

When configuring the ODBC Driver (as per the ODBC Driver Configration discussion above), you may get error The setup routines cannot be loaded due to system error code 126. The cause of this appears to be due to a couple of dll files missing from the install. These are:

  • mfc71.dll
  • msvcr71.dll

You will need to get these dlls from a machine which has the full client installed on it (they will be in c:\Windows\System32). Copy them either to your c:\Windows\System32 or your Instant Client directory.

Diagnosing Connection Problems

See the section Oracle - Diagnosing Connection Problems

转载于:https://www.cnblogs.com/yaoliang11/archive/2012/03/20/2408947.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值