Reprinted from :https://www.cnblogs.com/xdp-gacl/p/4171024.html

One 、H2 Database introduction

   Common open source databases are :H2,Derby,HSQLDB,MySQL,PostgreSQL. among H2 and HSQLDB similar , It is very suitable for embedded database , Most of the other databases need to install independent client and server .

  H2 The advantages of :
    1、h2 Adopt pure Java To write , So it's not limited by the platform .
    2、h2 only one jar file , It is very suitable for the embedded database trial .
    3、h2 Provides a very convenient web The console is used to operate and manage database content .

Two 、H2 Database download and installation

2.1、H2 Database download

  H2 Database download address :http://www.h2database.com/html/download.html

  

  

   Once the download is complete , Get the compressed package as shown in the figure below :

  

2.2、H2 Database installation

  H2 The database installation is very simple , Download it directly

  

   such ,H2 Even if the database is installed

2.3、 test H2 database

   Let's first introduce H2 Directory structure of database

  h2
  |---bin
  |    |---h2-1.1.116.jar   //H2 Database jar package ( The drive is also inside )
  |    |---h2.bat              //Windows Console launch script
  |    |---h2.sh                  //Linux Console launch script
  |    |---h2w.bat              //Windows Console launch script ( No black screen window )
  |---docs                       //H2 Help documentation for the database ( There are H2 Database user manual )
  |---service // adopt wrapper Packaged as a service .
  |---src //H2 The source code of the database
  |---build.bat //windows Build script
  |---build.sh //linux Build script

   function h2.bat Batch program start H2 database , As shown in the figure below :

  

   Open the browser , Enter the address :http://localhost:8082 visit H2 Database Web Console, As shown in the figure below :

  

   You can see the interface , That means H2 The database can be used normally .

3、 ... and 、 Easy to use H2 database

3.1、 Sign in H2 Database WebConsole Console

  

  

   After the connection test passes , Click on 【 Connect 】 Button , Log in to test Database webConsole, As shown in the figure below :

  

3.2、 Create table

   Copy H2 Examples provided by the database SQL Script , As shown in the figure below :

  

   perform SQL Script , As shown in the figure below :

  

  SQL Script execution results :

  

   All normal execution succeeded , You can see the created TEST surface , As shown in the figure below :

  

3.3、test Database file storage location description

   In the above operation , We use jdbc:h2:~/test This URL adopt JDBC The way to connect test database , As shown in the figure below :

  

   And then in test In the database, a TEST surface , Also on TEST The watch executed CRUD operation , So this test In which directory are the files of the database stored , It needs to be explained here "~" This symbol is in window What does the operating system mean , stay Window Under the operating system ,"~" This symbol represents the user directory corresponding to the user currently logged in to the operating system , therefore test The files corresponding to the database are stored in the user directory corresponding to the user logging in to the operating system , For example, I currently use Administrator Users log in to the operating system , So in "C:\Documents and Settings\Administrator\.h2" You can find test The database file corresponding to the database , As shown in the figure below :

  

3.4、 create new database

  

   Click on 【 Connect 】 Button , You can go in gacl Database console , As shown in the figure below :

  

   Now you can see H2 Automatically create the gacl Database and gacl user , And then in E:\H2 You can also find gacl Database file corresponding to database , As shown in the figure below :

  

   alike , We can also create new gacl Create tables in the database , And the watch CRUD operation , As shown in the figure below :

  

database H2 Learn more about articles

  1. Java embedded database H2 Learning summary ( 3、 ... and )—— stay Web Embed... In the application H2 database

    H2 As an embedded database , Its biggest advantage is that it can be embedded in our Web Application , And our Web Applications are bound together , Be us Web Part of the application . Let's show you how to H2 The database is embedded in our Web Application . One . Set up a survey ...

  2. Java embedded database H2 Learning summary ( Two )—— stay Web Used in applications H2 database

    One . Build test environment and project 1.1. build JavaWeb Test project Create a [H2DBTest]JavaWeb project , find H2 Database jar file , As shown in the figure below : H2 The database is just one jar file , This Jar The file contains ...

  3. Java embedded database H2 Learning summary ( One )——H2 Getting started with databases

    One .H2 Database introduction Common open source databases are :H2,Derby,HSQLDB,MySQL,PostgreSQL. among H2 and HSQLDB similar , It is very suitable for embedded database , Most of the other databases need to be installed independently ...

  4. Java embedded database H2 Learning summary

    H2 Summary of database usage  ——  The lone wolf

  5. NoSQL Database product learning summary ( One )

    NoSQL Database product learning summary ( One ) This article is divided into four chapters , I'll sort it out one after another Memcached.Redis.tair.mongodb.hbase.SequoiaDB. Cassandra Knowledge about . ...

  6. JDBC Learn how to operate the database (2)

    In the last blog <JDBC Learn how to operate the database (1)> In this paper, we give an example 1, We've learned a Java How the application passes through the program JDBC The procedure of operating the database , Of course, we also said that such examples can't be used in actual development , Ben ...

  7. mySQl Learning notes of database

    mySQl Learning notes of database ... ------------------ Dos command -- Write... In Notepad first . Then paste it into Dos In the middle -------------------------------- mySQ ...

  8. Mysql Basic database learning notes

    Mysql Basic database learning notes 1.mysql View the current login account name and database One . Single table query 1. Create database yuzly, Create table fruits Create table ) ) ,) NOT NULL,PRIMARY KEY( ...

  9. Open source database H2, HSQLDB, DERBY, PostgreSQL, MySQL difference / Comparison chart ( Additional translation ) h2 database

    Open source database H2, HSQLDB, DERBY, PostgreSQL, MySQL difference / Comparison chart Translated by longtianya blogger : referential integrity Referential integrity transactions things ...

Random recommendation

  1. /var/log/messages File monitoring

    Recently, there is a problem in the project , Here's the thing , We use ELK Medium LOGSTASH To monitor LINUX System log file for :/var/log/messages file , But the default permissions for this file are 600, It's hard , We use specific ...

  2. Python And MySQL

    In this article, we introduce Python3 Use PyMySQL Connect to database , And realize simple addition, deletion, modification and query . What is? PyMySQL? PyMySQL Is in Python3.x Version for connecting MySQL A part of the server ...

  3. [ Reprint ] Sina weibo MySQL Summary and reflection of optimization

    original text : http://mp.weixin.qq.com/s?__biz=MzA4Nzg5Nzc5OA==&mid=206762682&idx=1&sn=1233ed1496d7 ...

  4. SPA UI-router

    ------------------------------------------------------------------------------------ SPA SPA( Single page application ): ...

  5. take Callout Containers added to mobile device applications

    In mobile device applications ,callout It's the container that pops up at the top of the application . The container can hold one or more components , And supports different types of layouts . callout Containers can be modal or non modal . The modal container accepts all keyboards before it closes ...

  6. java process / Threads ; Heap and stack ; Multithreading

    One . Processes and threads process : Applications running in memory , One exe It's a process . Such as :ps -exf   You can view the process of each application , among ppid Parent process : ps aux | egrep '(cron|syslog)' ...

  7. TProfiler Deployment documents -- note

    TProfiler It is a performance analysis tool that can be used in production environment for a long time . It supports both profiling and sampling , Record the execution time and times of the method , Generate method hotspots Object to create hotspots Thread state analysis and other data , Provide data support for finding system performance bottlenecks . ...

  8. LeetCode Algorithm problem -Degree of an Array(Java Realization )

    This is the number one of Yuele book 294 Secondary update , The first 312 Original article 01 Reading and preparation Today's presentation is LeetCode Algorithm problem Easy Rank No. 162 topic ( Sequence question no 697). Given a non empty array of positive integers , The degree of the array is defined as any ...

  9. Xamarin.Android Use SimpleAdapter make ListView Universal adapter

    First step : establish layout1.axml To show the details of the list <?xml version="1.0" encoding="utf-8"?> <L ...

  10. plsql developer Connect Oracle Report errors ORA-12154: TNS:could not resolve the connect identifier specified

    Change today Oracle Use after network profile plsql developer Try connecting to Oracle There is an error ORA-12154: TNS:could not resolve the connect iden ...