我正在使用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
}
}
然而,当我运行它时,我收到了一串错误信息:
创建名为'transactionManagerPostProcessor'的bean时出错: bean的初始化失败
有人和Oracle一起做过Grails,请帮助我完成。 任何解决方案将不胜感激。谢谢。 TRAN。
答案 0 :(得分:0)
您需要在 lib 文件夹中包含ojdbc6.jar。
我也不确定localhost:1521:orcl,也许是localhost:1521 / orcl,其中 orcl 应该是服务名称。