[JAVA] How to create a database for H2 Database anywhere

Introduction System default when creating a new H2DB database JDBC URL: jdbc: h2: ~ / test (C: \ Documents and Settings \ [username] \ test) This is a solution when you want to create a directory directly under the C drive that can be accessed directly, but it does not work. This time I would like to create a database named "test" in the "C: \ data" directory.

Solution 1 From the H2 console, enter "jdbc: h2: C: \ data \ test" in JDBC URL: and click Connect ![1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/664939/b92121b1-fe6d-b90a-404e-e57a707c5df6.png)
  • You may be able to create a database with Solution 1, but you may not be able to create it due to a strange error.

Solution 2 (when Solution 1 is not good) ![2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/664939/84e1a159-9962-cd36-749e-c152703534e8.png) "Show hidden indicators" at the bottom right of the desktop → Right-click on "H2 Database Engine" →「Create a new database...」 ![3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/664939/2e755c7e-e887-0d58-8c5b-2cf95d15c3d9.png)

Database path:「C:\data\test」 Click Create

  • Password: is required to be entered, so enter an appropriate one.

Conclusion ![4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/664939/3b127fe9-5220-81f1-379f-e8632034060c.png) Database created

Supplement ![5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/664939/3a5620ab-5461-7215-62a5-3f545109d347.png)

If you use Solution 2, you can delete the password by executing this SQL command after connecting to the database. 「ALTER USER sa SET PASSWORD '';」

Recommended Posts

How to create a database for H2 Database anywhere
How to create a Maven repository for 2020
How to create pagination for a "kaminari" array
How to create a method
[Rails] How to create a signed URL for CloudFront
How to create a JDBC URL (Oracle Database, Thin)
[Spring Boot] How to create a project (for beginners)
[Java] How to create a folder
How to create a lightweight container image for Java apps
How to create and launch a Dockerfile for Payara Micro
[Swift5] How to create a splash screen
[rails] How to create a partial template
[Rails] rails new to create a database with PostgreSQL
[Rails] How to create a graph using lazy_high_charts
How to create a class that inherits class information
How to create a theme in Liferay 7 / DXP
How to make a lightweight JRE for distribution
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
[1st] How to create a Spring-MVC framework project
How to create docker-compose
How to easily create a pull-down in Rails
[Rails] How to create a Twitter share button
3. Create a database to access from the web module
How to create a Java environment in just 3 seconds
How to use an array for a TreeMap key
How to write a unit test for Spring Boot 2
How to create a Spring Boot project in IntelliJ
How to create a data URI (base64) in Java
[For those who create portfolios] How to use font-awesome-rails
How to make a mod for Slay the Spire
[Apple Subscription Offer] How to create a promotional offer signature
I want to create a generic annotation for a type
How to create an application
How to leave a comment
How to insert a video
Tutorial to create a blog with Rails for beginners Part 1
SDWebImage: How to clear the cache for a particular UIImageView
How to create a form to select a date from the calendar
How to create a placeholder part to use in the IN clause
[For those who create portfolios] How to use chart kick
How to test a private method with RSpec for yourself
How to output array values without using a for statement
[For those who create portfolios] How to omit character strings
Minecraft Modding [1.12] How to attach a special render for Item
Tutorial to create a blog with Rails for beginners Part 2
How to create a service builder portlet in Liferay 7 / DXP
Tutorial to create a blog with Rails for beginners Part 0
How to add columns to a table
How to specify validation for time_field
How to install JMeter for Mac
Preparing to create a Rails application
How to make a Java container
How to sign a Minecraft MOD
How to make a JDBC driver
Create a database in a production environment
Read H2 database for unit tests
How to write a ternary operator
[Swift] How to send a notification
How to make a splash screen
How to make a Jenkins plugin
How to make a Maven project