[英]How can i write correct oracle connection string in c#?
I'm beginner in oracle and c# ,i want simple application in c# use the oracle database,i write this connection string for connect to the database: 我是oracle和c#的初学者,我希望c#中的简单应用程序使用oracle数据库,我编写此连接字符串以连接到数据库:
conn.ConnectionString = "Data Source=BEHBEHZAD;User ID=SYSTEM;Password=beh1368421";
my full code is this: 我的完整代码是这样的:
OracleConnection conn = new OracleConnection();
conn.ConnectionString = "Data Source=BEHBEHZAD;User ID=SYSTEM;Password=beh1368421";
try
{
conn.Open();
conn.Close();
MessageBox.Show("Connect Successfull!!");
}
catch (Exception )
{
MessageBox.Show("Disconnect!!");
}
but when i run that program i get Disconnect Message,my TNS file detail is this: 但是当我运行该程序时,我收到了Disconnect Message,我的TNS文件详细信息是这样的:
BEHBEHZAD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = behbehzad)
)
)
How can i solve that?thanks. 我该如何解决呢?
ORA-12557 is apparently not related to your connection string but to a problem with your Path variable. ORA-12557显然与您的连接字符串无关,但与您的Path变量有关。 Please follow the instructions in this article .
请按照本文中的说明进行操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.