遠程連接的連接字符串可以這樣寫
oledbconnection 的連接字符串:
provider=msdaora;host=192.168.1.1;data source=mytest;user id=system;password=xxx
provider = msdaora; 指明oledb 的提供者是oracle數據庫
host 是遠程 oracle 數據庫所在服務器的ip地址,如果端口不是默認的 1521,還要加上一個 port=xxxx;
data source 是要訪問的 oracle 數據庫的名字
user id 和 password 就不說了。
.net managed provider for oracle 的連接字符串:
server=192.168.1.1;data source=mytest;user id=system;password=xxx
要能夠成功運行上面代碼,我們必須在代碼運行的機器上安裝 oracle 的客戶端,否則會報
the oracle(tm) client and networking components were not found 這個錯誤。