. NET project to link Oracle database-related configuration in ODAC mode

Source: Internet
Author: User
Tags dotnet oracleconnection

. NET project through theODACWay LinkOracledatabase-related configuration

First, the development environment

1. How to link ODAC

The ODAC directly uses the Oracle call Interface (OCI). OCI is a process or function that allows application developers to access an Oracle data server using a third-party development language, and an application interface that controls the execution state of all SQL statements.

2. advantages of using the Odac method

Use the odac Net option without installing an Oracle client on the client computer to connect to Oracle. in this case, ODAC only need TCP/IP protocol, so that you can create a real, minimal database application.

3. steps to use ODAC

1) Download ODAC Support plugin from official website

Address:http://www.oracle.com/cn/solutions/midsize/index-090165.html

Address:http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html

2) Add the following base dependency references to the project

OCI.DLL,OCIW32.DLL,ORANNZENTR11,ORANNZMCS11,ORANNZSBB11,ORAOCCI11,ORAOCIEI11,ORASQL11.DLL,ORASQLPLUSIC11 ( in Level Two directory under the path of the ODAC installer )

3) The addition of the above is tested without the addition of the three-digit and The four-bit, followed by a key reference.

Oracle.DataAccess.dll ( relative path in product\11.2.0\client_1\odp.net\bin\2.x)

4) use in the project

using Oracle.DataAccess.Client in the project; call this provided by the API Access Oracle;

5) Test Example

public void Connbyoracleclient ()    {        string connstring = @ "User Id=xxxxpassword=xxxx;data source= (DESCRIPTION =")    + "(ADDRESS = (PROTOCOL = TCP) (HOST = XX.xx.xx.xx) (PORT = 1521))"   + "(Connect_data ="     + "(SERVER = Dedicate D) "     +" (service_name = xx) "    +") ";        OracleConnection conn = new OracleConnection (connstring);        Conn. Open ();        String sql = "SELECT * from XX";         OracleCommand comm = new OracleCommand (SQL, conn);        OracleDataReader RDR = Comm. ExecuteReader ();        while (RDR. Read ())        {            string s = rdr. GetString (5);        }


6) test Results

Link succeeds and can read data everything is OK

Second, the server deployment configuration

1. Download the server corresponding to the ODAC Support installation package from the official website

Download ODAC Support plugin from official website

Address:http://www.oracle.com/cn/solutions/midsize/index-090165.html

Address:http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html

2. Unzip the odac.zip for installation.

Click setup.exe in the first-level directory to install and click Next. (See my blog http://blog.csdn.net/wangshuai6707/article/details/44788569 for detailed installation methods )

3. Replace the Odac Dependency reference used by the development environment in the project

Oracle.DataAccess.dll ( program installation relative path in product\11.2.0\client_1\odp.net\bin\2.x)

. NET project to link Oracle database-related configuration in ODAC mode

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.