简体   繁体   中英

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

I have Oracle (10g Express Edition) installed on one pc.

Visual Studio 2008 SP1 is installed on another pc.

I want to run an ASP.NET web app that uses the remote database. The two PCs are connected by a LAN (wired) connection. How can I connect to the database? What will the connection string be? The operating system on both PCs is 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;"; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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