Announcement Announcement Module
Collapse
No announcement yet.
How to attach database file from Grails to STS datasource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to attach database file from Grails to STS datasource

    Hi all,

    I want to be able to browse and edit my dev-datasource through STS.
    I am using standard Grails setup with the h2 driver, however i changed it to update and file - why it how looks like this:

    Code:
    dataSource {
        pooled = true
        driverClassName = "org.h2.Driver"
        username = "sa"
        password = ""
    }
    environments {
        development {
            dataSource {
                dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
                url = "jdbc:h2:file:devDb;MVCC=TRUE"
            }
        }
    }
    How can I attach this database file to STS so I can browse it, run queries and etc.? It seems I cant find the right jar for the job, and STS limits my possible connection types...

    Hope you can point me in the right direction!

  • #2
    I have never tried this myself, but in principal you should use the hsqldb jar that is located inside the grails install (in the lib folder) that you are using for the project. E.g. my grails 2.0.1 hsqldb jar is here: grails-2.0.1/lib/hsqldb/hsqldb/jars/hsqldb-1.8.0.10.jar. Use that when defining your connection.

    I'm not sure if you can access it at the same time the grails app is running.

    Have you tried the dbconsole for grails apps to see if that does what you need? When your app is running navigate to:
    http://localhost:8080/myapp/dbconsole
    (as described here: http://www.redtoad.ca/ataylor/2011/1...le-in-grails-2 )

    cheers,
    Andy

    Comment


    • #3
      Hi Andy,

      Thanks a lot for your post. After I posted mine, I found out about the dbconsole
      However, I am still gonna try using the suggestion you made, using the jar file you point out. Clearly I had my hands on the wrong one

      Cheers!

      Comment

      Working...
      X