3 implementation methods for. NET Connection Oracle

Source: Internet
Author: User
Tags oracleconnection
This article describes the 3 implementations of. NET-connected Oracle, a friend who needs to be able to

Mode 1: Direct utilization. NET Oracle-driven connections
Installing the Oracle Client driver package
Locate the server-side installation path: E:oracleproduct10.2.0db_1networkadmin 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 ();

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.