Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access mem or fs database tables using H2 console

I'm trying to access my application's tables in Play! Framework, but I can't find it using the console. For instance, I have two entity models: Address and Campus.

I can create objects and save normally, but I would like to see the changes in fs or mem DB, but the H2 console doesn't show the tables Address and Campus. I'm using the default settings to log in localhost:9000/@db.

What am I doing wrong?

Thanks in advance.

like image 912
Sedir Morais Avatar asked Jun 07 '11 13:06

Sedir Morais


People also ask

How do I access my H2 database table?

Accessing the H2 Console H2 database has an embedded GUI console for browsing the contents of a database and running SQL queries. By default, the H2 console is not enabled in Spring. Then, after starting the application, we can navigate to http://localhost:8080/h2-console, which will present us with a login page.

What is H2 database console?

The H2 Console application lets you access a database using a browser. This can be a H2 database, or another database that supports the JDBC API. This is a client/server application, so both a server and a client (a browser) are required to run it.

How do I open H2 in-memory database in browser?

H2 Console Before accessing the H2 database, we must enable it by using the following property. Once we have enabled the H2 console, now we can access the H2 console in the browser by invoking the URL http://localhost:8080/h2-console.


1 Answers

The correct URL for the inmemory database is:

jdbc:h2:mem:name-of-your-play-db
like image 75
Juan Ramón Paniagua Avatar answered Oct 24 '22 11:10

Juan Ramón Paniagua