试图让 SQLite 与 grails 一起工作......我在网上找到的东西似乎有点过时 - 对常春藤和插件等的引用,但基于这些:
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
我已经能够让它在测试环境中工作......奇怪的是,当我“刺激战争”我的 grails 应用程序并部署到 tomcat 时它失败了:
找不到方言类:hibernate.SQLiteDialect
这是我的设置:
在 conf/hibernate 中为 SQLiteDialect 添加了一个类。这个 .java 取自这里http://code.google.com/p/hibernate-sqlite/
然后在我的 DataSource.groovy 我有:
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"
}
}
}
在 BuildConfig.groovy 我有:
dependencies {
runtime 'org.xerial:sqlite-jdbc:3.6.17'
}
我还 jar'd 了 .java 方言类并放入 lib - 一些帖子说这有帮助。我还将 sqlite-jdbc-3.7.15-M1.jar 放在 lib 中。
现在,当我在我的开发环境中运行应用程序时,它运行良好......但是当我部署到 tomcat 时,我得到了方言错误。
我需要对方言的 prod 环境做些什么特别的事情吗?