DBCP connection property name issue

153 Views Asked by At

I am making a simple program using MyBatis. At this time, I am having difficulty applying DBCP to the configuration file(mybatis-config.xml) containg DB connection information.

<property name="initialSize" value="5" />
<property name="testOnReturn" value="true" />
<property name="maxActive" value="30" />
<property name="maxIdle" value="5" />
<property name="maxWait" value="-1" />
<property name="testOnBorrow" value="true" />
<property name="testWhileIdle" value="true" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="60" />
<property name="logAbandoned" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<property name="minEvictableIdleTimeMillis" value="60000" />
<property name="validationQuery" value="select 1 from dual" />
<property name="numTestsPerEvictionRun" value="20" />

When I did this and ran the program, I got the following error:

Error building SqlSession The error may exist in SQL Mapper Configuration Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: Unknown Datasource property: maxIdle

If the property names is change as below, it runs without error:

<property name="poolMaximumActiveConnections" value="30" />
<property name="poolMaximumIdleConnections" value="5" />
<property name="poolMaximumCheckoutTime" value="-1" />

From what I've found, the above method that gives me an error has items I want to set, so I want to solve this error. Do you know anyone well? For reference, java version is 1.8 and mybatis-3.1.1.jar is applied. I tried applying commons-dbcp-1.4.jar just in case, but the error is the same before or after applying the library.

Please tell me your options.

0

There are 0 best solutions below