How to connect. net to oracle

Source: Internet
Author: User
Tags oracleconnection

 

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.