Mode 1: Direct utilization. NET Oracle-driven connections
Installing the Oracle Client driver package
Locate the server-side installation path: E:\oracle\product\10.2.0\db_1\NETWORK\ADMIN under Tnsnames.ora, overwrite the file with the client driver
Configuring client-side Drivers
1. Open Data source Management
2, select the System DSN, click [Add]
3, the pop-up interface selected Oracle in Oradb10g_1 driver, pop-up Oracle ODBC Driver Configuration Interface
4. Fill out four data items, Source Name, TNS Services name User ID
Where TNS Servers name refers to server-side settings service names
This section can be omitted
When Setup is complete, determine
Quoting System.data.oracleclient;
Copy Code code as follows:
Using System.data.oracleclient;
String oradb = "Data source=water;" User Id=modis; Password=modis;integrated Security=no ";
OracleConnection conn = new OracleConnection (ORADB);
Conn. Open ();
(My environment is only supported for Vs2005,oracle data source connections below 10g.) )
Mode 2: Install Odp.net (Oracle Data provider.net) and connect via OLE DB.
Quoting System.Data.OleDb;
Copy Code code as follows:
Using System.Data.OleDb;
String oradb = "Provider=oraoledb.oracle;data source=water; User Id=modis; Password=modis; ";
OleDbConnection myconnection = new OleDbConnection (ORADB);
Myconnection.open ();
Mode 3: Install the odp.net, through the Oracle Connector
Reference dynamic link library Oracle.DataAccess.Client.
Copy Code code as follows:
Using Oracle.DataAccess.Client;
String oradb = "Data source=water;" User Id=modis; Password=modis; ";
OracleConnection conn = new OracleConnection (ORADB); C#
Conn. Open ();