Reputation: 362
I use grails 2.3.11 in my application.
Can i get currently used datasource dialect in runtime?
I just need to check what DB type i use (oracle or H2).
Thanks!
Upvotes: 0
Views: 233
Reputation: 75671
Yes, you can call the getDialect()
method in the SessionFactory. Dependency-inject the bean in a service or wherever:
def sessionFactory
and then the current Dialect instance is available using
Dialect dialect = sessionFactory.dialect
Upvotes: 2