Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create new database in H2?

Tags:

h2

railo

I have a site running locally on MySQL i want to run it on H2 database. I have just run h2.jar file for console on the browser but whenever I Log in I have seen the list jdbc:h2:/var/www/mysite/data/db; MODE=MySQL, information_schema and users.I can create tables in it but don't know how to create new database?

I am using Mode = MySQL type = H2 Database Engine in Embedded mode.

like image 387
Suleman khan Avatar asked Jun 23 '14 18:06

Suleman khan


People also ask

How do I start H2 database in server mode?

To start the H2 Console tool, double click the jar file, or run java -jar h2*. jar , h2. bat , or h2.sh . A new database is automatically created by default if an embedded URL is used.

How do I add data to my H2 database?

Syntax. Following is the basic syntax of INSERT INTO statement. INSERT INTO tableName { [ ( columnName [,...] ) ] { VALUES { ( { DEFAULT | expression } [,...] ) }

What is H2 database in spring boot?

H2 is an embedded, open-source, and in-memory database. It is a relational database management system written in Java. It is a client/server application. It stores data in memory, not persist the data on disk.


1 Answers

From http://www.h2database.com/html/tutorial.html#creating_new_databases,

By default, if the database specified in the URL does not yet exist, a new (empty) database is created automatically. The user that created the database automatically becomes the administrator of this database.

like image 73
Dylan Gattey Avatar answered Nov 09 '22 02:11

Dylan Gattey