数据库
首页 > 数据库> > c#连接oracle 数据库

c#连接oracle 数据库

作者:互联网

 项目需引用:Oracle.ManagedDataAccess.dll


string connectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["oracleDB"].ToString(); OracleConnection connB = new OracleConnection(connectionString); connB.Open(); Console.WriteLine("测试数据库连接成功!"); Console.WriteLine(); connB.Close();

 

配置文件

 <add name="oracleDB" providerName="System.Data.OracleClient" connectionString="Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 9000)) ) (CONNECT_DATA =(SERVICE_NAME = orcl))); User Id=system;Password=123;"  />    

 

标签:Console,c#,connB,数据库,connectionString,WriteLine,oracle,OracleConnection
来源: https://www.cnblogs.com/lehailong/p/12881542.html