Results 1 to 3 of 3

Thread: How to attach database file from Grails to STS datasource

  1. #1
    Join Date
    May 2008
    Posts
    27

    Question 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. #2
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    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

  3. #3
    Join Date
    May 2008
    Posts
    27

    Default

    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •