开发者

What is the exact format of a connection string for Oracle?

I have this code:

string conStr = @"server=ORACLE1001;database=Test;uid=admin;pwd=1234";
mycon = new OleDbConnection();
mycon.ConnectionString = ConStr;

and it throws exceptio开发者_StackOverflow社区n that provider must be like "Provider=SQLOLEDB;" so I tried with conStr = "Provider=OraOLEDB.Oracle.1;server=ORACLE1001;database=Test;uid=admin;pwd=1234; and it throwed exception "ORA-12560: TNS:protocol adapter error" - anny ideas how to fix this? Any ideas what is wrong with my conStr?


Please follow the steps and then you will never worry about connection strings for any DBs(including access and excel)!

(1) create a new empty foo.txt

(2) rename it to foo.udl

(3) double click the file, you will see a wizard, with a few tabs and options

(4) do what you want, at last click OK

(5) open foo.udl with notepad(or rename it back to foo.txt)

(6) you can see the most standard connection string in the world

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜