Oracle client-free for. Net (added analysis devart and DataDirect)

Source: Internet
Author: User

I am just a common. Net developer. I often use sqlserver, and occasionally use other databases, which can be connected and then select/execute. But it is my small wish that it will be hard to achieve in the face of oracle.

Although Oracle development projects started in, every time you encounter problems, you can use them. This time I encountered another problem, even more outrageous: the same version of newlife. xcode, the same machine, the same ODP. Net version, which was written last monthProgramWell-working, easy to use, just a new one, no way to write! Therefore, it took three days and three nights to completely solve the problem (staying up till one or two in the morning ).

 

We know that using. Net to connect to the Oracle database has two drivers, one with built-in. Net and the other with ODP. Net developed by Oracle () (To register, we will provide a team later ). The one that comes with. Net does not support non-update in MS, so ODP. NET is usually used for development. In addition, the. NET driver must be used to connect to the database in TNS mode, rather than the following:

Data Source = (description = (address = (Protocol = TCP) (host = 192.168.1.34) (Port = 1521) (CONNECT_DATA = (Server = dedicated) (SERVICE_NAME = ORC); User ID = admin; Password = admin;

Otherwise, an error is returned:

The connection option "Data Source" is invalid. The maximum length is 128.

 

Develop a. Net program that supports oracle. The standard process is to first install the Oracle client, and then use the. NET built-in driver or ODP. net. In fact, as long as you follow this process, there will be basically no errors. If you want to make an error, it is only a TNS error. The most intolerable thing is that the Oracle client is huge, although it is still very large to install the Oracle client later. As a result, a master made a lite client. There were many online versions and the results were quite good.

Of course, Oracle is not idle, and instantclient is launched, with no more than 30 m MSI installer. Finally, we got rid of the huge client.

However, human desires are endless! With a smaller runtime, we also hope to achieve installation-free, which can be used with the copy of the main program we developed. After verification by multiple parties, the key to Oracle client Runtime is OCI. That is to say, no matter what language the program is written in, you only need to find the OCI at runtime. DLL to connect to the Oracle database.

Decompile ODP.. net. dataaccess. DLL finds that it first looks for the Registry, then the configuration file, and finds some settings from it. The first one is the dllpath. I guess this is the OCI path. So I backed up the instantclient file after installation, unmounted it, and ensured no residue in the registry. Release the backup file and specify the path in the project configuration file:

Actually adding a segment:

<Configsections> <SectionName="Oracle. dataaccess. Client"Type="System. Data. Common. dbproviderconfigurationhandler, system. Data, version = 2.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089"/> </Configsections>

 

Then set the dllpath:

<Oracle. dataaccess. Client> <Settings> <AddName="Dllpath"Value="D: \ oracle \ OCI"/> </Settings> </Oracle. dataaccess. Client>

 

TestCodeEverything works! This indicates that the program can work normally as long as the directory where OCI. dll is located can be found. Of course, if you put the files in this directory directly in the Software Directory, you can also use it.

Here, I am used to thinking that I can use it as long as I copy the installed files. However, it was found that the installation file of instantclient was less than 30 m, but it was 139 m after installation (in fact, the latest driver is 2.112.2.0, and the online instantclient is 2.112.1.0, the two files are basically the same ):

As shown in the figure, oraociei11.dll accounts for 126 MB. Search for a variety of simplified Oracle client solutions online. Several files are required:

OCI. dll, orannzsbb11.dll, oraocci11.dll, oraociei11.dll, It is essential ......

Of course, there are two more: Oracle. dataaccess. dll and oraops11w. dll. Some installation packages can also put oraops11w. dll together with OCI.

Sorry! These files are compressed to MB, and the maximum compression speed is 30 mb. It is very slow to decompress them! (This package will be downloaded later)

 

Is there no way to make it smaller than this? No! A friend told me that oracle9i310 is a very small running time (points are deducted for download on the Internet, and local download is provided later). It is only 13 MB, but installation is required.

However, this operation is difficult. If you use the latest oracle. dataaccess. DLL to connect, a version mismatch is reported!

 

(Here is a description about version incompatibility)

The provider is not compatible with the version of Oracle client

The provider is incompatible with the Oracle client of this version.

This is the most common error in the Development of. Net for Oracle programs.

In fact, this is the use of ODP. net frequently encountered problems in ODP.. net, Oracle. dataaccess. DLL => oraops11w. DLL => OCI. DLL, the versions of the preceding two must match 100% (oraops11w. the DLL is hard-coded) (maybe this is the Oracle official version of oraops11w. DLL and Oracle. dataaccess. DLL ). The later versions do not seem to have high requirements. They are references between C ++.

The version requirements of the. NET Oracle driver are very low. As long as OCI. dll can be found, it basically works well and won't check the version or something. If OCI. dll cannot be found, this error is reported:

System. Data. oracleclient requires Oracle client software 8.1.7 or later.

Of course, the OCI directory (set in the environment variable path) does not work. You have to set the environment variable ORACLE_HOME to the OCI directory. Otherwise, an error is reported (because OCI. dll uses another DLL ):

Ocienvcreate failed. The Returned Code is-1, but the error message text is unavailable.

 

Let's get down to the truth!

If the latest ODP. Net driver cannot run with oracle9i310, try Ms. Set the environment variable ORACLE_HOME to the oracle9i310 directory, and add the bin directory under the Environment Variable path (in OCI. dll ). The test is normal! This indicates that 9i supports green release.

 

Next, we should begin to streamline oracle9i310.

The installation package of less than 13 m is only 35 m after installation, far smaller than the latest ODP. Net driver, and less than 9 m after compression.

After removing unnecessary things, the remaining 28 m is compressed to 6.5 m. This should be the minimum Oracle client runtime.

 

Comprehensive comparison:

 

. Net built-in Oracle driver

ODP. Net driver

Write the connection string TNS Supported Supported
Non-TNS method of the connection string Not Supported Supported
Support for running oracle9 Supported Not Supported
Support for running oracle11 Supported Supported
OCI directory settings Set in environment variable path Set in environment variable path
Or
Configure the dllpath in the configuration file
Or
Set dllpath in Registry
Other environment variables You need to set ORACLE_HOME None
Size of the installation package during running 9i runtime installation package 13 m Installation Package 30 m during 11g running
The latest ODP. Net has a total of 52 m
Green simplified size 9i runtime 6.5 m 11g runtime 30 m
Differences Low performance The highest performance and many features
     

:

Oracle9i client runtime Lite version 6.5 m

Oracle11g client runtime Lite version 30 m

 

The original version 13 m when the Oracle9i client is running

The original version is 52 m when the oracle11g client is running.

 

(Changes may occur at any time. The latest group announcement prevails !)

 

Increase Network Disk sharing because FTP cannot afford it:

9i Lite version: http://www.kuaipan.cn/file/id_2378544298602218.html

11g Lite version: http://www.kuaipan.cn/file/id_2378544298602215.html

9i Original: http://www.kuaipan.cn/file/id_2378544298602216.html

11g Original: http://www.kuaipan.cn/file/id_2378544298602217.html

 

(FTP has seriously affected the server network and is now disabled)

 

Follow-up:

Devart dotconnect for Oracle

InOnecoolAndChubby 2010To analyze devart.

1. Name obfuscation makes analysis difficult

2. Use LIC authorization, which is very fragile

3. I found that calling OCI. dll and processing environment variables such as home still seems to be inseparable from OCI. dll.

Comprehensive Evaluation: Compared with ODP. net, it has no advantages and is still charged (there are also free versions)

 

DataDirect

In yuanyouWizardwuOfA blogFound this guy.

1. The product description is very attractive. The only 100%-managed code data provider does not require the Oracle OCI client library. Yes, this is what we dream!

2. The latest version is 3.5. You need to apply for a trial. At ten o'clock A.M., the launch of group friends, using a variety of domestic and foreign mailboxes, IP addresses, VPN applications, can not receive emails. Three o'clock P.M.. Download started.

3. Find a 2.1 version (for. NET 1.0) from csdn in the morning, which is not obfuscated. It adopts LIC authorization and supports OEM and self-write symmetric encryption.Algorithm, Built-in password without any processing, very fragile

4. We can clearly see the process of data packet unpackaging, network transmission, and receiving in version 2.1. I didn't see anything related to OCI and home. Certainly, this is purely managed code and does not require OCI.

5. Analyze 3.5 (for. NET 2.0/4.0) in the afternoon. The name is mixed and it is also LIC authorization. You can see the layout of the class and namespace. You don't need to analyze it.

Comprehensive Evaluation, right,This is what we need. We strongly recommend it !!!No price found. It seems that you must contact them. I don't have much time to run the test. I think there are many reports online!

Among them, Version 2.1 is of great reference value for Oracle, sqlserver, Sybase, and DB2 packages!

2.1 Download: http://www.kuaipan.cn/file/id_2378544298602742.html

3.5 download: http://www.kuaipan.cn/file/id_2378544298602758.html

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.