1. Download installation package
H2 official website: http://h2database.com/html/main.html
H2 tutorial: https://www.ctolib.com/docs/sfile/h2-database-doc/Quickstart/index.html
2. Install H2 database
Select the installation directory -> Click Next -> Installation -> Complete
3. Log in to H2 database
The advantage of selecting the installation version is that there is an H2 console} icon after installation. Click the icon to directly start H2 and use the default browser to access the H2 login page
However, the H2 database of win 2019-10-14 does not automatically create a test database, so you can’t log in here
The error information is as follows:
Database “C:/users/COM/test” not found, either pre create it or allow remote database creation (not recommended in secure environments) [90149-200] 90149/90149 (help)
4. Login error resolution
1. Click the small yellow icon under the taskbar and select Create a new database
Select the installation path C:\users\com
Note: H2 database is installed under C:\users\com by default (COM is the system user name)
After the creation is successful, a new test will be created in the directory mv. DB file
Test again and the connection is successful
5. Data import and export
(1) Data export
CALL CSVWRITE('D:\Hadoop\H2\hello_world.csv', 'SELECT * FROM hello_world');
(2) Data import
CREATE TABLE hello_world AS SELECT * FROM CSVREAD('D:\Hadoop\H2\hello_world.csv')
(3) Data insertion
INSERT INTO hello_world SELECT * FROM CSVREAD('D:\Hadoop\H2\hello_world.csv');