Grails and SQLite

Trying to get SQLite to work with grails ... the material I found on the Internet seems a bit dated - links to ivy and plugins, etc., but based on them:

http://stackoverflow.com/questions/1199512/grails-sqlite
http://bigohno.blogspot.com/2010/01/groovy-on-grails-sqlite.html
http://maven-repository.com/artifact/org.xerial/sqlite-jdbc/3.6.17

I managed to get it to work in a test environment ... strange, when I "prod war" my grails application and deploy it to tomcat, it fails:

Dialect class not found: hibernate.SQLiteDialect

Here is my setup:

a class for SQLiteDialect has been added to conf / hibernate. This .java was taken from here http://code.google.com/p/hibernate-sqlite/

Then in my DataSource.groovy I have:

hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
    development {
        dataSource {
            // SQLite
            // !!!see also BuildConfig for Dependancies!!!
            dbCreate="update"
            url='jdbc:sqlite:C:\\sqlite-shell-win32-x86-3080100\\rss_1.db'
            logSql="true"
            dialect="hibernate.SQLiteDialect"
            driverClassName="org.sqlite.JDBC"
            readOnly="true"

        }
    }

    production {
        dataSource {
            // SQLite
            dbCreate="update"
            url="jdbc:sqlite:/opt/sqlite/dbs/rss/1/rss_1.db"
            logSql="true"
            dialect="hibernate.SQLiteDialect"
            driverClassName="org.sqlite.JDBC"
            readOnly="true"
            showsql="false"

        }
    }
}

and in BuildConfig.groovy I have:

dependencies {

        runtime 'org.xerial:sqlite-jdbc:3.6.17'

    }

I also jar'd up the .java dialog class and inserted it into lib - some posts said this helped. I also added sqlite-jdbc-3.7.15-M1.jar to lib.

, , ... tomcat, .

- , prod ?

+4
1

, SQLite Grails:

SQLite http://www.sqlite.org/download.html, . .

JDBC SQLite https://bitbucket.org/xerial/sqlite-jdbc libs grails.

SQLIte... google search, , https://github.com/gwenn/sqlite-dialect < 3 >

grails src/java .

jar lib.

grails, :

dataSource {
            // SQLite
            dbCreate="update"
            url="jdbc:sqlite:/opt/sqlite/dbs/rss/1/rss_1.db"
            logSql="true"
            dialect="SQLiteDialect"
            driverClassName="org.sqlite.JDBC" 
}

. , sqlite , ( ).

BuildConfig.groovy sqlite jdbc, :

dependencies {

        runtime 'org.xerial:sqlite-jdbc:3.6.17'

    }

!

+10

All Articles