[Reprinted] Summary of. Net Access to Oracle

Source: Internet
Author: User

 For a long time, I have been using ms SQL Server/Access database, through. Net Access Ms home things almost never encountered any trouble. Recently, I used oracle as a database in my project. I learned some things about. Net accessing Oracle and found that there are actually a lot of problems.

1. System. Data. oracleclient and system. Data. oledb namespaces

Although the classes in the two namespaces can access the Oracle database. data. the class efficiency of the sqlclient namespace is higher than that of the system. data. the class in the oledb namespace is higher), system. data. the classes in the oracleclient namespace are larger than those in the system. data. the oledb namespace class is more efficient (I did not personally verify this, but most places will say so, moreover, since the things specifically designed for Oracle should also be specifically optimized in theory ).

Of course, another point is to make system. Data. oracleclient better:

For example, the data type, system. data. oledb. system is not listed in oledbtype enumeration. data. oracleclient. which are specific in the oracletype enumeration. In addition, if the number type of Oracle is large, it exceeds. NET data type range, you must use system. data. special Class in oracleclient-oraclenumber type.

Well, I will not repeat these two comparisons. The following mainly discusses the types in the namespace of system. Data. oracleclient, that is, ADO. Net for ORACLE data provider.Program).

2. Database connection:

Whether you use system. Data. oledb or system. Data. oracleclient to access Oracle, you must install the Oracle client component on the. NET running machine (Web server in ASP. NET. (This is different from the two types of MS databases, MS things install MDAC: Microsoft Data Access Component 2.6 or later, there is no need to install the SQL Server Client or office software, .)

System Requirements:

(1) If you use system. Data. oracleclient to access Oracle, the client component version should be later than Oracle 8i client Release 3 (8.1.7. The MS only ensures access to Oracle 8.1.6, Oracle 8.1.7, and Oracle 9i servers. MDAC 2.6 or above.

(2) If you use system. Data. oledb to access Oracle, the client component version 7.3.3.4.0 or later may be 8.1.7.4.1 or later. MDAC 2.6 or above.

If the server is Oracle8i or above, the client component version should be 8.0.4.1.1c.

In. net running machine, install the Oracle client, and then open net manager (Oracle 9i)/easy config (Oracle 8i) set the local service ing based on your previous experience (the service name here is used for database connection strings ).

The connection string used to access the Oracle database in system. Data. oracleclient is:

User ID = user name; Password = password; Data Source = service name

(The above is a general connection string. Detailed connection string items can be found in the document of the system. Data. oracleclient. oracleconnection. connectionstring attribute .)

The connection string used to access the Oracle database in system. Data. oledb is:

Provider = msdaora.1; user id = user name; Password = password; Data Source = service name

 

 

 

 Summary of access methods

After checking the Oracle website, msdn2005, and registry, I hope to help you.

Now let's look at the text:

1. ODBC Mode
Choose my computer> Control Panel> (performance and maintenance>) management tools> data source (ODBC)> system DSN> Add ", check that the ODBC driver installed in the system contains "Microsoft ODBC driver for Oracle ".
Therefore, if you use ODBC to access Oracle, you do not need to install the Oracle client;

2. oledb Mode
Open Registry Editor regedit and search Oracle to find the following keys:
Microsoft ole db provider for Oracle
Hkey_classes_root \ CLSID \ {e8cc4cbe-fdff-11d0-b865-00a0c9081c1d} \ ole db Provider
Hkey_classes_root \ msdaora
Therefore, if you have installed an appropriate version of MDAC, you can use oledb to access Oracle.

3. system. Data. oracleclient Mode
Both of the above are common methods. Let's take a look at the classes specifically written for Oracle by M $.
Please open msdn2005 and enter the address
MS-help: // Ms. msdnqtr. v80.chs/MS. msdn. v80/MS. visual Studio. v80.chs/wd_adonet/html/054f76b9-1737-43f0-8160-84a00a387217.htm (you can also find it by directory, index, or search)
System Requirements for Oracle. NET Framework data providers (Class in the namespace of system. Data. oracleclient) are summarized as follows:
Oracle. NET Framework data providers require Microsoft Data Access Component (MDAC) version 2.6 or later. We recommend that you use MDAC 2.8 SP1.
You must also install the Oracle 8i Release 3 (8.1.7) client or later.
Oracle client software earlier than Oracle 9i cannot access the UTF16 database, because UTF16 is a new feature in Oracle 9i. To use this feature, you must upgrade the client software to Oracle 9i or later.
Haha, M $ is not as diligent as we think. He just made a package for Oracle client.

4. Oracle data provider for. Net (ODP. Net)
When we go back to Oracle's hometown, we can find that he boast about ODP. Net in many places and can see what requirements it has to use.
Please enter the address in your browser (the Oracle website is a little slow, please do not worry)
Http://www.oracle.com/technology/tech/windows/odpnet/faq.html#install
Q: What do I need to have installed on my client machine to have ODP. Net work?
A: You will require the following:
Windows 2000, Windows XP Professional, or Windows Server 2003
Microsoft. NET Framework 1.0 or higher
Oracle9i client Release 2 (9.2) or higher
Oracle Net Services (supported with the client)
Oracle services for Microsoft Transaction Server, Release 2 (9.2) or higher. This is required for applications using distributed transacations.
Simple translation:
If you use ODP. Net to access the Oracle database, you need the following conditions:
Operating System: Win2k XP 2003
. NET Framework 1.0 or above
Clients above Oracle9i

5. opinion of the third party:
In http://www.fawcette.com/vsm/2003_07/magazine/columns/databasedesign/
There Is A Article called >
explains how to access Oracle in a visual environment (that is, by clicking or dragging a mouse.
ole db is used.

Now let's make a summary.
Comrades, let's review history and look forward to the future. We will carry forward XXXX and hold yyyy high (5000 words omitted below )......
1. You can use ODBC or oledb to access Oracle without installing the Oracle client;
2. If you prefer to install things on other machines, you can use ODP. Net with the "best performance" (as mentioned on the Oracle website) to access Oracle;
3. If you use system. Data. oracleclient, you can have a little bit of decoration, but there are more help documents than 2, and we seem to be used to Microsoft.
4. we recommend that you use system. data. oledb classes to access Oracle. Advantages: (1) I don't like to install too many things in other people and my own machines because I am lazy. (2) it can run on systems above Win98, while the method in 2 and 3 can only run on systems above Win2k. (3) ODBC seems too old, it seems that I am a moderate school ...... (ah, old -_-)

Well, thank you for your continued reading of this article. I hope it will not waste your time and help you.

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.