H2 database console provides an awesome and very helpful web based interface to view any database. You can view the database by following URL
http://localhost:8080/applicationName/dbconsole
or following URL If you have set application context to ‘/’ by using grails.app.context = ‘/’ in Config.groovy.
http://localhost:8080/dbconsole
By default URI is /dbconsole but if you want you can change it. Just add following code in Config.groovy:
grails.dbconsole.urlRoot = 'myconsole'
and now your URL becomes
http://localhost:8080/applicationName/myconsole or http://localhost:8080/myconsole
H2 database console by default available in development environment only. If you want you can disable it for development environment also. Use the following settings
environments { development { ... grails.dbconsole.enabled = false } production { ... } }
And you can enable it for other environments as well like:
environments { development { ... } production { ... grails.dbconsole.enabled = true } }
Hope this helps 🙂 .
Recent Comments