java c3p0配置oracle_oracle数据库 配置c3p0怎么也配不对。老师能给一个oracle配置的教程不...

spring-dao.xml如下

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context.xsd">

class="com.mchange.v2.c3p0.ComboPooledDataSource"

destroy-method="close" >

${c3p0.acquireIncrement}

${c3p0.initialPoolSize}

${c3p0.idleConnectionTestPeriod}

${c3p0.maxStatements}

${c3p0.numHelperThreads}

jdbc配置文件如下:

driver=oracle.jdbc.driver.OracleDriver

#正式数据库

#url=jdbc:oracle:thin:@10.123.128.42:1521:csi

#测试数据库

#url=jdbc:oracle:thin:@localhost:1521:csi

url=jdbc:oracle:thin:@127.0.0.1:1521:hpttestdata

#dev

#url=jdbc:oracle:thin:@10.123.134.114:1521:csi

username=hpt

password=hpt

#定义初始连接数

initialSize=5

#定义最大连接数

maxActive=20

#定义最大空闲

maxIdle=20

#定义最小空闲

minIdle=1

#定义最长等待时间

maxWait=60000

datasource.defaultAutoCommit=true

hibernate.dialect=org.hibernate.dialect.Oracle9Dialect

#当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3

c3p0.acquireIncrement=5

#初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3

c3p0.initialPoolSize=10

#每60秒检查所有连接池中的空闲连接。Default: 0

c3p0.idleConnectionTestPeriod=600

#-连接池中保留的最小连接数。

c3p0.minPoolSize=5

#连接池中保留的最大连接数。Default: 15

c3p0.maxPoolSize=50

#JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements

#属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。

#如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0

c3p0.maxStatements=100

#c3p0是异步操作的,缓慢的JDBC操作通过帮助进程完成。扩展这些操作可以有效的提升性能

#通过多线程实现多个操作同时被执行。Default: 3

c3p0.numHelperThreads=10

#最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0

c3p0.maxIdleTime=600

#hibernate.dialect=org.hibernate.dialect.SQLServerDialect

hibernate.jdbc.batch_size=25

hibernate.jdbc.fetch_size=50

hibernate.show_sql=true

hibernate.connection.release_mode=after_transaction

报错信息

Caused by: org.apache.ibatis.exceptions.PersistenceException:

### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

### The error may exist in file [D:\project_main\o2o\target\classes\mapper\AreaDao.xml]

### The error may involve com.lykq.o2o.dao.AreaDao.queryArea

### The error occurred while executing a query

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

... 35 more

Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)

at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:81)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值