简体   繁体   English

c#如何在连接字符串上设置Oracle Home?

[英]c# How to set the Oracle Home on the connection string?

I have two Oracle Homes in my machine ( Oracle 9 and Oracle 11) . 我的机器上有两个Oracle Homes(Oracle 9和Oracle 11)。 Oracle 9 Home is the default home. Oracle 9 Home是默认主目录。 How can I set my connection string to use Oracle 11's Home? 如何设置连接字符串以使用Oracle 11的主页?

In windows you could use the LOCAL environment variable to point to the tns_alias that connects to your requested services. 在Windows中,您可以使用LOCAL环境变量来指向连接到您请求的服务的tns_alias。 On *nix platforms you can use the TWO_TASK variable to do the same. 在* nix平台上,您可以使用TWO_TASK变量执行相同的操作。

In both cases you use whatever software the ORACLE_HOME points to and use sql*net to connect to your database. 在这两种情况下,您都使用ORACLE_HOME指向的任何软件,并使用sql * net连接到数据库。 In your situation you use the client software from the Oracle 9 Home and you can connect to a database that is running Oracle 11 software. 在您的情况下,您可以使用Oracle 9 Home中的客户端软件,并且可以连接到运行Oracle 11软件的数据库。 (not 100% sure about the ability to connect to v11 with a v9 client but if this is possible, this is the way to do that) (不能100%地确定使用v9客户端连接到v11的能力,但是如果可能的话,这是这样做的方法)

If you really want to use the v11 client software, you need to setup your environment where ORACLE_HOME points to the v11 software location and PATH points to your v11 ORACLE_HOME/bin. 如果确实要使用v11客户端软件,则需要设置环境,其中ORACLE_HOME指向v11软件位置,而PATH指向v11 ORACLE_HOME / bin。 You could still use LOCAL or TWO_TASK to connect but if your database runs on the same host, you can also set ORACLE_SID (and unset TWO_TASK) to your default connection. 您仍然可以使用LOCAL或TWO_TASK进行连接,但是如果您的数据库在同一主机上运行,​​则还可以将ORACLE_SID(并取消设置TWO_TASK)设置为默认连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM