Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Users and Roles

Sergei Makarov
Sergei Makarov
13,839 Points

'in memory' - H2 DB is empty

How can I get the tables shown in my h2 DB. As I run my app (and of course don't stop it, cause db is just in memory), I get an empty DB by the jdbc:h2:mem:todotoday address; I've already tried adding DB_CLOSE_DELAY=-1 to the end of url. It doesn't work also. I've already added username and password, cause this two parameters weren't exist in application.properties and I also get an empty DB. I have also tried h2-Shell, but no success in order to get the tables shown;

What is wrong?

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

jdbc:h2:tcp//localhost:9999/mem/todotoday this is not memory db. "Server Mode"

jdbc:h2:mem:testing is in memory db

jdbc:h2:test is embedded db

Here take a look at docs:

http://www.h2database.com/html/cheatSheet.html

if you took info from here:

http://kh-yiu.blogspot.de/2014/08/how-to-browse-content-of-h2-in-memory.html

it is still a workaround: they fire up server any way. But yeah. Ok. I was wrong. Glad that you've found solution. I delete that. I didn't believe that anyone can access the in memory db like that. That is interesting. Thanks for a link