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 conn开发者_如何学Pythonect 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;";
精彩评论