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