On several databases used in the work

Source: Internet
Author: User
Keywords Well can we work relational database

Several years of work down, also used several kinds of database, accurate point is "database management system", relational database, there are nosql.
Relational database:
1.MySQL: Open source, high performance, low cost, high reliability (these features tend to make him the preferred database for many companies and projects), for a large scale Web application, we are familiar with such as Wikipedia, Google, and Facebook are the use of MySQL. But the current Oracle takeover of MySQL may have some concerns about the future of MySQL's free application.

My experience: MySQL installation is very convenient, almost in the next step in the process of completion. And for the operation and management of MySQL there are many third-party plug-ins support, I used to have "MySQL Query Browser", "Navicat for MySQL", "sqlyogent" personal feeling from the use of experience and response speed sqlyogent better. Programming language interface, MySQL almost support all the mainstream programming language, I personally used the pure C + + connector/c++, very useful, is completely in accordance with the JDBC specification encapsulation; Java JDBC,HIBERNATE;MFC ODBC.

Said several work encountered in the MySQL small problem (latent rule), do not understand when in the development of the really bring themselves a lot of confusion:
(1) Case: In a communication server wrote a MySQL connection pool, through the client's call to get the connection for the corresponding database operations, and sometimes found such a problem, the connection is not empty, but the database operation has failed, the heart unavoidably produced a big doubt, and because of this problem is not reproducible , so did not find a solution, and finally read the MySQL document to find the cause of the problem: MySQL's effective connection if no database operation within 8 hours will be invalidated, rely on null judgment is not come out, must be effective judgment, Method can be a random database operation to see whether the error, for connection pool if the error to discard this invalid connection, and then create a new valid connection into the connection pool.

(2) Case: MySQL Maximum connection number. Such a simple question? About the maximum number of connections you know, MySQL general default support of the maximum number of connections is 100, that is, you have created 100 of connections, and then create a connection will fail, yes, we all know: But I do not know if you are aware of the maximum number of PreparedStatement, Do not believe you try to continue to create PreparedStatement, when the maximum number, PreparedStatement will also be ineffective, regardless of the time you create several database connections.

2.Microsoft SQL Server: Previous SQL Server is suitable for small and medium sized database solutions, but with the introduction of new releases, the enhancements of functionality and performance have touched the database management of large enterprises. I've recently used SQL Server 2005, and one of the new features that I'm feeling is "hardening the processing power of XML, adding local XML data types, and XML query operators that support native XML data types." But from the access of SQL Server, we also know that the purchase of genuine is a large amount of money, I think small companies generally will not consider him it.

My usage Experience: The installation is not very clear, I only remember that at that time to install a large number of components, a series of configurations, and need a lot of disk space, which reflects the "complexity" of SQL Server, so if MySQL can meet your development needs, recommend to abandon SQL Server bar , and from a cross-platform perspective, it would be a direct exit. For his management I use Microsoft's own management Studio, personal feeling pretty good, third party has navicat for SQL Server. I'm impressed by the memory of using SQL Server: It's cool to debug stored procedures with Server Explorer in Visual Studio.

3.SQLite: Lightweight relational database, but full support for acid (atomicity, consistency, isolation, durability), suitable for small, stand-alone projects, which has a network of articles in detail on the SQLite of the relevant information, there are introductory knowledge, community, limitations of introduction, feel very good and very full, Interested buddies can look at http://blog.csdn.net/wangguang246/article/details/6090289.

My experience: the use of C + + cppsqlite (CodeProject Open source code) encapsulation, using Java JDBC, using QT qsqlite, all operation is very simple, but in Qt encountered a problem, do not support database operations exception handling? (Anyway, I did not find), the most sqlite to consider the limitation is: can not be oriented to table and row locking, but the database-level locking efforts, so to read and write is not. Third-party plug-in operation Management SQLite I use the SQLite Expert Professional, it is very useful.

NoSQL:
MongoDB: Open source NoSQL database, written in C + +. The following is quoted from the Open source China community: "MongoDB is a product between relational and non relational databases, and is the most functionally rich, relational database in the relational database." The data structure he supports is very loose and is a JSON-like Bjson format, so you can store more complex data types. The biggest feature of MONGO is that the query language he supports is very powerful, and its syntax is somewhat similar to an object-oriented query language, which can almost achieve most of the functions of a single table query like relational database, and also supports indexing data.

Its features are high-performance, easy to deploy, easy to use, storage data is very convenient. The main functional features are:
For collection-oriented storage, it is easy to store data of object types.
Mode of freedom.
Supports dynamic queries.
Supports full indexing, containing internal objects.
Support Queries.
Support for replication and recovery.
Use efficient binary data storage, including large objects such as video.
Automatically handles fragmentation to support cloud level scalability
Support ruby,python,java,c++,php and many other languages.
File storage format is Bson (a JSON extension)
Accessible over the network

The so-called "set-oriented" (collenction-orented) means that data is grouped in a dataset and is called a set (Collenction). Each collection has a unique identity name in the database and can contain an unlimited number of documents. The concept of a set is similar to (table) in a relational database (RDBMS), but it does not need to define any schema.

Mode Freedom (schema-free) means that we do not need to know any of its structural definitions for files stored in the MongoDB database. If necessary, you can store files of different structures in the same database.

A document stored in a collection that is stored as a key-value pair. Keys are used to uniquely identify a document, a string type, and a value can be a complex file type in each. We call this storage form Bson (Binary serialized dOcument format).

The MongoDB server can run on Linux, Windows, or OS X platforms, supporting 32-bit and 64-bit applications with a default port of 27017. It is recommended to run on a 64-bit platform because the maximum file size supported by MongoDB in 32-bit mode is 2GB. ”

My experience: We use MONGODB in projects primarily for log storage and reading because of the large amount of logs, the inefficient use of traditional relational databases, and MongoDB's performance in terms of efficiency (mainly because of the MongoDB memory-mapped relationship), For important business logic or use of relational databases, because MongoDB does not support transactions, and there are some feedback that MongoDB often inexplicably lose data, we use it for less important log storage. There is also a problem, we are using service-initiated MongoDB server, when the service exception exits, the MongoDB server can not start the next time, this will result in the loss of data, you need to manually delete the database directory under a lock file, MongoDB can be normal to enable.

The following is the link is provided by MongoDB official website to support the C + + interface http://www.mongodb.org/pages/viewpage.action?pageId=133415, if you know a lot about JSON, Then the MongoDB must be very fast, for Java can see the following link "http://www.mongodb.org/display/DOCS/Java+Language+Center", it is worth mentioning that, There is still support for ORM Morphia "Http://code.google.com/p/morphia/wiki/QuickStart".

(Responsible editor: Lu Guang)

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.