Java learning: HSQLDB document (1)

xiaoxiao2021-03-06  61

Recently, HSQLDB has been studied, try to translate its documentation, it is posted and shared, welcome everyone and I communicate: WWCCFF@163.net is HSQLDB? HSQLDB has the following features: a Java database with open source has a standard SQL syntax and Java interface HSQLDB can freely use and distribute very simple and fast with memory databases, stand-alone databases, and C / s databases in the applet. Using more details: Index can be created and automatically used to support transaction to allow table-related integrity references and constraints to support Java stored procedures and function databases to generate SQL scripts to use username, password, access, etc. Security mechanisms can be used by Java1. 1 and Java2 compile HSQLDB based on Hypersonics QL, is a versatile database, very small, and easy to install and use. Can be used in Applets, in the test, in the application system. Since the standard SQL and JDBC interfaces are provided, HSQLDB can easily perform data conversion between other databases. The current latest version of HSQLDB is 1.7.1, provided in the form of a compressed package, including JAR files, documents, source code, test programs, examples, etc., can be used. Two mode of operation introduction HSQLDB has two operating modes: internal mode (only using applications in the same JVM) C / S mode (multiple computer / systems can access the same database) Access mode Access mode in the process is independent mode. The independent mode here is in relation to the C / S mode (client program access database server). Here, the database and application run under the same JVM. At this time, the database is actually equivalent to the code repository called by the application. The procedures and databases communicate via a universal JDBC call, but this call is internal call and does not need to communicate via network. In this mode, a database can only have an application access, otherwise, use the C / S mode (allowing multiple JVMs or computers to access the same database at the same time). The URL of the JDBC in this mode is as follows: JDBC: HSQLDB: Test Here, Test is the database file name. Another example (under Windows System): JDBC: HSQLDB: C: / DB / TEST C / S Access Mode This mode is not running under the same JVM process, but has its own independent process or Independent machine. You don't need a client program to enter the server's file system. Database mode of operation in this mode does not differ from some large databases (such as SQL Server, Oracle, etc.). Can be on the Internet or intranet. In addition to their own access protocols, HSQLDB also supports standard HTTP protocols, allowing access to the firewall or proxy server to access the database.

All Server Modes The Actual Database File Name Is Specified in The Java Command That Starts The Server. This Can Be The Dot "......... Three of the Path for the Database Name Server Mode: Server , WebServer and servlet. The communication protocol in this mode is the HSQL proprietary protocol based on TCP / IP. Each client has a separate connection. This mode response speed is very fast. If you use a C / S mode, this service mode should be used. The JDBC URL in this mode is: JDBC: HSQLDB: HSQL: // HSQLDBSRV Here, HSQLDBSRV is the machine name. If you run multiple servers on a machine, you need to specify ports, for example: JDBC: HSQLDB: HSQL: // HSQLDBSRV: 9002, if it is a local computer, use localhost: JDBC: HSQLDB: HSQL: // localhost. WebServer sometimes, due to the existence of a firewall or proxy server, you need to communicate with the HTTP protocol. The system provides a small and simple webserver to correspond to the database, for example: JDBC: hsqldb: http: // Websrv servlet This mode And the Webserver mode is very similar, the database is running in a servlet, while servlets can run in almost all WebServer. And compatible with the Java Servlete API (the test environment is J2DK2.1). This is directly accessed through the network. If your servlet does not directly access this database, do not use this mode. All memory access (all-in-memory) mode The so-called full-memory access mode is that all data (including indexing and recording) are saved in the main memory. This means that the size of the database is limited by the memory size (cannot exceed the size of memory). The reason for supporting this model is: In non-log mode, this mode can be slightly faster, can be used to store temporary data (application system data cache) on Applet, as follows: JDBC: HSQLDB: In this mode, memory and hard drives In this mode, the database changes will be written to the hard disk, which means that the table in the memory will be recreated according to their data when the database is started. Alternatively, you can create a table to save the data. When you access the database, only a small amount of records are saved in memory. You can use 'Create Cached Table' to replace 'Create Table' when you are created. Thus, the big table (the records of these tables are too larger than the memory). The index of the caching table can also be saved to the hard disk. Therefore, the size of the database may not be limited by the memory size. Entering the cache table is slower than getting data from the memory table. Starting from the 1.7.0 version, support the third mode: the data can be stored in a text file (such as a file in the CSV format). Corresponding statement: 'Create Text Table'. The current state is saved to the disk before turning off the database. The data in the cache table is saved to a separate file.

转载请注明原文地址:https://www.9cbs.com/read-116469.html

New Post(0)