Method 1: connect directly using the. NET oracle driver
Install the Oracle client driver package
Find the Server installation path: E: \ oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN tnsnames. ora, and overwrite the file under the client driver.
Configure the client driver
1. Open Data Source Management
2. Select the system DSN and click [add].
3. Select the Oracle in OraDB10g_1 Driver on the displayed interface. The Oracle ODBC Driver Configuration interface is displayed.
4. Fill in four Data Source names TNS Services Name User ID
The TNS Servers Name indicates the service Name set on the server.
This part can be omitted
Confirm after setting
Reference System. data. oracleclient;
1 using System. data. oracleclient;
2 string oradb = "Data Source = water; User Id = modem; Password = modem; Integrated Security = no ";
3 OracleConnection conn = new OracleConnection (oradb );
4 conn. Open ();
(My environment is VS2005, and oracle Data source connection only supports 10 Gb or less .)
Method 2: After installing ODP.net (Oracle Data Provider. NET), use OLEDB to connect.
Reference System. Data. OleDb;
1 using System. Data. OleDb;
2 string oradb = "Provider = OraOLEDB. Oracle; Data Source = water; User Id = modem; Password = modem ;";
3 OleDbConnection myConnection = new OleDbConnection (oradb );
4 myConnection. Open ();
Method 3: After installing ODP.net, use the Oracle Connector
Reference the dynamic link library Oracle. DataAccess. Client.
1 using Oracle. DataAccess. Client;
2 string oradb = "Data Source = water; User Id = modem; Password = modem ;";
3 OracleConnection conn = new OracleConnection (oradb); // C #
4 conn. Open ();
From the column of baple