. Net connection to Oracle

Source: Internet
Author: User

To connect. Net to Oracle:

(1) install the Oracle client. The version must be the same as that on the server. Note: If Oracle is 32-bit, the client on the 64-bit machine must also be 32-bit.

(2) Configure listeners and services in net configuration assistant. Add a listener to net manangerProgram, Set the server host name.

(3) download odp.net (Oracle data provider for. net), which is consistent with the previous version. Installation is complete.

(4) Several Connection Methods of C:

(1) This method does not require step (3. Directly connect to the. NET Oracle driver. Add using system. Data. oracleclient to the program;

Code
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 is only supported below 10 Gb.

(2) After installing odp.net, use oledb to connect. Reference using system. Data. oledb;

Code
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 ();

(3) After installing odp.net, use the Oracle connector to reference the dynamic link library oracle. dataaccess. Client.

Code
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 ();

 

Related URL: http://www.connectionstrings.com /? Carrier = Oracle

Http://www.diybl.com/course/4_webprogram/asp.net/asp_netshl/200853/112441.html

Http://www.oracle.com/technology/global/cn/obe/net11gobe/getstarted-c/getstarted_c.htm#t3

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.