简体   繁体   English

如何使用ASP.NET连接到远程Oracle数据库?

[英]How to use ASP.NET to connect to a remote Oracle database?

I have Oracle (10g Express Edition) installed on one pc. 我在一台PC上安装了Oracle(10g Express Edition)。

Visual Studio 2008 SP1 is installed on another pc. Visual Studio 2008 SP1已安装在另一台PC上。

I want to run an ASP.NET web app that uses the remote database. 我想运行一个使用远程数据库的ASP.NET Web应用程序。 The two PCs are connected by a LAN (wired) connection. 两台PC通过LAN(有线)连接进行连接。 How can I connect to the database? 如何连接到数据库? What will the connection string be? 连接字符串是什么? The operating system on both PCs is Windows XP. 两台PC上的操作系统均为Windows XP。

A lot of that will depend on what driver you're using. 这很大程度上取决于您使用的驱动程序。 If you take a look at this site , you should get an idea of the connection string you'd need for whatever database driver you choose. 如果您浏览此站点 ,则应该了解选择的任何数据库驱动程序所需的连接字符串。

Try following: 请尝试以下操作:

string strConnectionString= "Data Source=(DESCRIPTION="
             + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=_YOUR_SERVER_NAME_)(PORT=_YOUR_SERVER_PORT_)))"
             + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=_YOUR_SERVICE_NAME_)));"
             + "User Id=YourUserID;Password=YourPassword;"; 

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

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