Grails: dbconsole does not show domain classes

This beautiful blog says that in dbconsole I should see small icons on the left for my tables, for example, as he sees "BOOK". http://www.redtoad.ca/ataylor/2011/11/h2-database-console-in-grails-2/

I use STS and grails 2.0, and I am building an application with several domain classes (I can go to the controllers and view the lists, etc.), but the domain classes are not displayed in the dbconsole. Just goes straight to INFORMATION_SCHEMA .

Where are my domain classes? I can see the lists and use .findBy and stuff !!

+7
source share
2 answers

You need to change the url to what it says in your DataSource.groovy

The URL must be changed on this initial screen. enter image description here

+18
source

Thank you Mikey! I have the same problem! In fact, take a look

 grails-app/conf/DataSource.groovy 

At least in my case, the JDBC URL can be set to jdbc: h2: mem: devDb for the development database, jdbc:h2:mem:testDb for the test database and jdbc:h2:mem:prodDb for the production database.

The console does not have the ability to find out which one you prefer, so it checks by default. In addition, if you click "JDBC URL" in dbconsole mode in a browser, it will show you some tips. In particular, it explains that “The jdbc: h2: ~ / test URL means that the database is stored in the user's home directory in files starting with“ test. ”Indeed, I now have test.h2.db in my home directory test.h2.db , test.lock.db and test.trace.db . This also explains why the data is not saved by default. Didn't you notice that when you set the default every time you restart Grails, you need to recreate all the objects ? Well, this is because of the ": mem:" part in the JDBC URL.

This default value is probably not related to Grails; I would suggest that H2 simply creates a test database in your default home directory unless otherwise noted. I also assume that you can have many different databases in a complex production environment, which is why Grails is not trying to guess what exactly you want.

Also see official H2 documentation

+1
source

All Articles