VC ++ Database Technology series (I) basic database knowledge

Source: Internet
Author: User

 

We know that there is a famous formula in the program field: program = Data + algorithm. This fully demonstrates the importance of data in programming. When the data size reaches a certain level, in order to achieve rapid data storage and fast access, you must use a database for data storage. Because the database is a warehouse that organizes, stores, and manages data according to the data structure, using the database for storage has the advantages of fast storage and access, convenient management, reasonable organization, and reduced data redundancy.

 

There are many types of databases. From the simplest storage of tables with various types of data to the large database systems capable of storing massive data, they have been widely used in various aspects. The database model includes a hierarchical structure model, a mesh structure model, and a relational structure model. This chapter describes the access technology of the most widely used relational database.

 

Features of Visual C ++ Database Development


I,
Diverse database access technologies available

Visual c ++ 6.0 provides a variety of Database Access Technologies-odbc api, mfc odbc, Dao, ole db, and ADO. These technologies have their own characteristics. You can select development technologies that suit your needs based on your technical proficiency and project characteristics.

II,
Visual Wizard provided by VC simplifies the development process

Using the Appwizard and classwizard provided by VC, you can easily develop a database application based on MFC with excellent performance. You don't even need to write a code statement. You can click it to generate a complete simple database application.

III,
The powerful ide compiler greatly improves the development efficiency.

Vc ide is one of the most powerful compilers in the world. Using the various auxiliary tools provided by the IDE, you can easily and quickly compile, compile, link, and Debug Programs, which is much more efficient than the general compiler.

IV,
Flexible development methods and moderate development difficulty

Visual c ++ allows you to develop databases in a variety of ways. Both process-oriented development and object-oriented development. You can call the Assembly Code directly or use the DLL dynamic library to perform mixed programming with other programming languages. A wide range of class libraries and COM libraries provide powerful support for development.

V,
Good architecture makes it highly scalable

Visual c ++ has the characteristics of object-oriented programming. Through abstraction, inheritance, overloading, polymorphism, and other features, interface-oriented programming can make the entire database system have a good architecture and support good scalability. Using interface-Oriented Programming and COM component programming technology, each component can be seamlessly replaced, greatly improving the scalability and robustness of the program.

VI,
High program execution efficiency and Fast Running Speed

 

We know that C ++ is a language close to machine language in advanced languages, so its execution efficiency is generally second only to assembly language. In addition, where the execution efficiency is relatively high, compilation can be embedded directly, which greatly improves the execution efficiency of the program. In addition, Visual C ++ uses code optimization technology to increase the execution efficiency of programs by more than 10 percent. This is incomparable to other advanced languages.

 

Visual c ++ Database Development Technology

 


As mentioned above, Visual C ++ provides a variety of technical support for database development. User-selectable database access technologies include ODBC (Open Database
Connectivity), mfc odbc (Microsoft
Foundation Classes ODBC), Dao (Data Access Object), ole db (Object Link
And embedding database), ADO (ActiveX Data Object ). These technologies have their own characteristics and their applicability are also different. Therefore, users generally need to make appropriate choices based on the technical characteristics and project features.

1,ODBC

Advantage: ODBC is a unified interface provided by the customer's application to access the relational database. ODBC provides a unified set of APIS for different database accesses, in this way, the application can only write the program for the odbc api to access any database that provides the ODBC driver. In addition, ODBC is an industry standard. Almost all relational databases provide corresponding ODBC drivers, so it is widely used.

Disadvantage: however, because ODBC can only be used for relational databases, it is difficult for ODBC to access object databases and other non-relational databases. ODBC is an interface layer that provides adaptability to different databases, which will inevitably reduce the efficiency. In addition, when using ODBC, You need to register a data source with the system, which increases the configuration difficulty. It also needs to access the database through a large number of ODBC unified interface APIs, which also increases the development difficulty.

2,MFC ODBC

Advantages and disadvantages: Because mfc odbc only uses the MFC class library mfc odbc to encapsulate ODBC APIs in a simple way, making APIs easier to use, its advantages and disadvantages are the same as those of ODBC, it only reduces the development difficulty.

3,Dao

Advantage: Dao (Data Access Object) is an application programming interface (API). It is provided by Microsoft to access Microsoft Jet Database Files (*. MDB) is a powerful database development tool. Dao is Microsoft's first object-oriented database interface. Each Dao object works collaboratively. With the jet function, it can also access other Structured Query Language (SQL) databases. Because Dao is directly embedded in the access runtime environment, Dao is the most efficient database engine for accessing MDB files. MFC also provides a set of Dao classes, encapsulates the underlying APIs, And the VC wizard also provides support for Dao, which greatly simplifies program development. You do not have to register a DSN In the ODBC manager.

Disadvantage: Dao is based on the Microsoft Jet Engine and can only access desktop databases supported by the jet engine. Therefore, you need to access SQL
Server must be accessed through ODBC.

4,OLE DB

Advantage: ole db is a visual
C ++ develops new technologies in database applications. Ole db provides unified interfaces for all file systems, including relational databases and non-relational databases. Therefore, using ole db can provide extensive support for most databases. At the same time, it is a low-level application interface, so it is more efficient than ODBC.

Disadvantage: Using ole db directly to design database applications requires a lot of code. Even if you can use the ATL template to reduce the workload, the development is relatively difficult. It can be said that he is the most difficult of all database programming interfaces.

5,ADO

Advantage: ADO is an object-oriented programming interface that provides a familiar and high-level automation encapsulation interface for ole db. It inherits Ole
The advantages of DB technology are easy to use, high access efficiency, and powerful functions. Because it is object-oriented, it is implemented internally through the interaction of various objects. You can access both relational databases and non-relational databases.

 

Disadvantage: The only drawback should be that it is based on the COM technology, so it cannot be used across platforms. It can only be used on machines that support com interfaces, that is, Microsoft's Windows system. Development Using VC ++ is not a disadvantage.

 

 

VC ++ Database Technology series (2)

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.