1, what is ODF. NE,? Oracle data Provider is specifically written for. NET (odp.net), one for the Oracle Access API for Microsoft. NET environments.
Detailed explanation http://www.oracle.com/technetwork/cn/testcontent/o23odp-084525-zhs.html for the official code, no longer exists!
Odp. NET you do not need to install Oracle, do not need to configure the Oracle.key file, do not need to configure the Tnsnames.ora file does not need to configure environment variables; complete idiot without installing an Oracle database or
Clients such as any Oracle products machine to access the Oracle database!
Here is a detailed explanation of how odp.net data operations for Oracle "can be completed, curd (additions and deletions)"
Step one : Get the class library file that supports the database connection: How doesOracle.DataAccess.dll get it?
To the official website to the corresponding version http://www.oracle.com/technetwork/cn/topics/dotnet/index-088718-zhs.html
To run 64-bit. NET program, you must use 64-bit odp.net, to run 32-bit. NET programs, you must use 32-bit odp.net, and finally give Odp.net32 bit and 64-bit: 64-bit http://www.oracle.com/technetwork/ Database/windows/downloads/index-090165.html32 bit http://www.oracle.com/technetwork/database/windows/downloads/ Index-101290.html
After downloading the installation will appear in your installation directory \dp.net\bin\2.x (Figure 1) This Oracle.DataAccess.dll, copy it to your solution under the reference
Figure 1
By the way, click Oraprovcfg.exe automatically configures environment variables (Figure 2)
Figure 2
Successfully obtain the required DLL files, some people have to go to a file to unzip, to configure, I do not want to see, if necessary, this is a detailed configuration steps
http://blog.csdn.net/Sunlihgt_love/article/details/5423926
Step two : Before you use it formally, you need to add a reference to your project:
Oracle.DataAccess.Client Set the database connection and so on common functions,
Oracle.DataAccess.Types Setting some data types for Oracle customization
Step three : illustrative examples
Information such as the following database is provided
Database server address: 192.168.10.20
Library Name: 44410g242
Account Number: 44bikll
Password: 487gf,.q
The string that connects to Oracle is like this (2 ways to provide my test)
String constring = "Data source= (description= (address= (protocol=tcp) (host=192.168.10.20) (port=1521))" +
(Connect_data= (SERVER = dedicated) (service_name = 44410g242)); User id=44bikll; password=487gf,.q; ";
String constring = "Data source= (description= (address= (protocol=tcp) (host=192.168.10.20) (port=1521))" +
(Connect_data= (sid=44410g242)); User Id=44bikll; password=487gf,.q; ";
Write connection string above 2 method connections can be, or can be placed in Web. config.
The above connection protocol TCP and port 1521 are the default, without modification, such as the port is occupied needs to be changed.
2 Tables Tblocklog and Tbaccount are involved in this case
View Code
Show Results:
The following are: 1. Database Creation
Create a table named Oracletypestable
"CREATE Table oracletypestable (MyVarchar2 varchar2), MyNumber number (28,4) Primary key, MyDate Date,myraw R AW (255)) ";
insert a row of data
INSERT into oracletypestable values (' Test ', 4,to_date (' 2000-01-11
12:54:01 ', ' yyyy-mm-dd hh24:mi:ss '), ' 0001020304 ');
Description of other operations: (Instruction for use: http://www.oracle.com/technetwork/cn/testcontent/o23odp-084525-zhs.html)
Attention:
1, the SQL statement in the case is still a little different from MSSQL;
2, statistics if not get statistics of the data will be an error, this is why I add if (rdr. Getoraclevalue (0). ToString () = = "NULL")//Prevent null
3,webservice don't know why he has a distinction between the case of a user name.
Step four : Deployment notes
When deploying to the real server, you also follow the steps in step one to install the client odp.net file, click the Execute EXE file to automatically configure environment variables to see if the installation is successful.
Note that the version is consistent, this is the key to running your program, open cmd, execute: C:\Documents and settings\administrator>Sqlplus/nolog can know the version
My results:
Here are a few of the issues associated with the version of the article---version of the ODP. NET development and deployment related issues
Http://www.cnblogs.com/yjmyzz/archive/2011/04/19/2020793.html
Http://www.cnblogs.com/codingsilence/archive/2011/07/14/2146497.html
Http://blog.chinaunix.net/uid-20049824-id-1980177.html
supplementing which 11.2.0.3.50 beta will be more appropriate for fast operation of Oracle, but requires support from Win7 and. NET Framework 4, the general enterprise estimate has not yet put Win7 as a server!
Http://www.oracle.com/technetwork/database/windows/downloads/odpmbetainstall-1696475.html
This http://www.bitscn.com/pdb/oracle/200904/160401.html Instant client on-line installs Oracle clients in bulk-
The installation configuration also requires that you copy the Oracle.key file from the machine on which you have installed Oracle and configure environment variables.
Just so much, I hope to help you. , the following is the DLL for odp.net
Use Odp.net to access Oracle (. NET access to Oracle)