我正在使用Grails 2.4.5,我想连接到oracle数据库。
在DataSource.groovy
上,我添加了:
dataSource {
pooled = true
driverClassName = "oracle.jdbc.driver.OracleDriver"
dialect = "org.hibernate.dialect.Oracle10gDialect"
dbCreate = "update"
url = 'jdbc:oracle:thin:@localhost:1521:orcl'
username = "root"
password = "root"
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = false
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "select 1 from dual"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
defaultTransactionIsolation = Connection.TRANSACTION_READ_COMMITTED
}
}
但是,当我运行它时,我收到一堆错误消息:
有人在Oracle上完成了Grails,请帮助我解决问题。
任何解决方案将不胜感激。谢谢。
特兰
最佳答案
您需要在lib文件夹中包含ojdbc6.jar。
另外我不确定localhost:1521:orcl,也许是localhost:1521 / orcl,其中 orcl 应该是服务名称。