简体   繁体   English

在C#中具有SID的oracle连接字符串

[英]oracle connection string with SID in c#

Hi I have to connect to an Oracle Database( about which I know a little) using a windows application. 嗨,我必须使用Windows应用程序连接到Oracle数据库(我对此有些了解)。 The windows application will not necessarily be in the same system. Windows应用程序不一定在同一系统中。 I just needed the connection string. 我只需要连接字符串。 So I Used Add connection functionality in Visual Studio 2014 to test the connection and get the string. 因此,我在Visual Studio 2014中使用了添加连接功能来测试连接并获取字符串。 eedb is the SID which i read in stackoverflow question eedb是我在stackoverflow问题中读取的SID

在此处输入图片说明

Now using above, i was able to connect to the database using this functionality and even in my visual studio server explorer all the tables of the oracle database were showing but I needed to use the connection string in the windows application. 现在使用上面的代码,我可以使用此功能连接到数据库,甚至在我的Visual Studio服务器浏览器中,oracle数据库的所有表都已显示,但是我需要在Windows应用程序中使用连接字符串。 So I used following string: 所以我用下面的字符串:

DATA SOURCE=172.31.8.21:1521/eedb;USER ID=PDB_E_GND_R

I added password too to this string as 我也为这个字符串添加了密码

DATA SOURCE=172.31.8.21:1521/eedb;USER ID=PDB_E_GND_R;PASSWORD=123

when i run the application i get error. 当我运行该应用程序时,出现错误。

System.Data.OracleClient.OracleException: ORA-01017: invalid username/password; logon denied.

So : Why I am getting this error. 所以:为什么我得到这个错误。 Now some may mark this question as duplicate and even point out the answer can be found in issue stackoverflow question 现在有些人可能将此问题标记为重复,甚至指出可以在问题stackoverflow问题中找到答案

Coz if this was the case I would have been unable to establish connection through add connection functionality of Visual Studio at all. 如果是这种情况,我将根本无法通过Visual Studio的添加连接功能建立连接。 Please note: I added the reference: Oracle.DataAccess 请注意:我添加了参考:Oracle.DataAccess

And also for a programmer like me who has very little knowledge regarding the oracle. 对于像我这样对oracle知识很少的程序员也是如此。 How I can know which connection string I have to use for a particular oracle db. 如何知道特定的oracle数据库必须使用哪个连接字符串。

Try the following connection string EZ connect does not seem to be so EZ 尝试以下连接字符串EZ connect似乎不是EZ

data source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.31.8.21)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = eedb)));USER ID=PDB_E_GND_R;PASSWORD=123 数据源=(描述=(地址列表=(地址=(协议= TCP)(主机= 172.31.8.21)(端口= 1521)))(连接数据=(服务名称= eedb)));用户ID = PDB_E_GND_R;密码= 123

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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