免安装oracle驱动访问数据库
try { string connStr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.110.110)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ZXITORCL)));Persist Security Info=True;User ID=tj122webnew;Password=tj122webnew;"; using (var conn = new OracleConnection(connStr)) { conn.Open(); Response.Write("连接成功!"); } } catch (OracleException ex) { throw new Exception(ex.Message); }
注意:需要下载Oracle.ManagedDataAccess.dll动态库,同时该动态库运行在.net 4.0中