Oracle的连接字符串的确切格式是什么? [英] What is the exact format of a connection string for Oracle?

查看:199
本文介绍了Oracle的连接字符串的确切格式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

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

并抛出了一个例外,即提供程序必须类似于 Provider = SQLOLEDB;。
,所以我尝试使用 conStr = Provider = OraOLEDB.Oracle.1; server = ORACLE1001; database = Test; uid = admin; pwd = 1234;
并引发异常 ORA-12560:TNS:协议适配器错误-anny想法如何解决此问题?任何想法对我的conStr有何影响?

and it throws exception 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?

推荐答案

请按照以下步骤进行操作,那么您将永远不必担心任何数据库(包括访问和excel)的连接字符串!

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

(1)创建一个新的空foo.txt

(1) create a new empty foo.txt

(2)将其重命名为foo.udl

(2) rename it to foo.udl

(3)单击文件,您将看到一个向导,其中包含一些选项卡和选项

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

(4)完成您想要的操作,最后单击确定

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

(5)用记事本打开foo.udl(或重命名回foo.txt)

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

(6)世界上的标准连接字符串

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

这篇关于Oracle的连接字符串的确切格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆