JDBC driver properties does not work when using DBCP
----------------------------------------------------
Key: IBATIS-78
URL: http://issues.apache.org/jira/browse/IBATIS-78
Project: iBatis for Java
Type: Bug
Components: SQL Maps
Versions: 2.0.9
Environment: Windows, Tomcat 5.0, Oracle 9i
Reporter: Sukhyung Lee
I am using iBatis Sqlamp with Oracle and have Oracle type compare problem.
Oracle CHAR type compare problem is :
1) User table has user_id = '111'
2) user_id column type is CHAR(7)
3) When I set user_id = "111" and the select statement could NOT find the row.
4) When I set user_id = "111 " and the select statement could find the row.
The java source code is here.
String user_id = "111"; // Search fail
//String user_id = "111 "; // Search successful
try
{
User user = new User();
user.setUser_id(user_id);
user = (User) sqlMap.queryForObject("getUser", user);
if (user == null)
{
System.out.print("Can not find User . user_id=" + user_id);
}
else
{
System.out.println("User Information:");
System.out.println("user_id=" + user.getUser_id());
System.out.println("user_name=" + user.getUser_name());
}
}
I set Driver.fixedString to true to solve Oracle CHAR type compare problem like
below. (Actually to solve this problem I need Custom Type Handler also)
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property value="${driver}" name="JDBC.Driver"/>
<property value="${url}" name="JDBC.ConnectionURL"/>
<property value="${username}" name="JDBC.Username"/>
<property value="${password}" name="JDBC.Password"/>
<property value="128"
name="Pool.MaximumActiveConnections"/>
<property value="128"
name="Pool.MaximumIdleConnections"/>
<property value="1000" name="Pool.MaximumWait"/>
<!-- To resolve Oracle CHAR Type compare problem,
need fixedString=true-->
<property value="true" name="Driver.fixedString"/>
</dataSource>
</transactionManager>
It worked fine and I and trying to use DBCP instead of SimpleDataSource and
modified transactionMangager definition like below.
<transactionManager type="JDBC">
<dataSource type="DBCP">
<property value="${driver}" name="JDBC.Driver"/>
<property value="${url}" name="JDBC.ConnectionURL"/>
<property value="${username}" name="JDBC.Username"/>
<property value="${password}" name="JDBC.Password"/>
<property value="15"
name="Pool.MaximumActiveConnections"/>
<property value="1"
name="Pool.MaximumIdleConnections"/>
<property value="5000" name="Pool.MaximumWait"/>
<!-- To resolve Oracle CHAR Type compare problem,
need fixedString=true-->
<property value="true" name="Driver.fixedString"/>
<!-- DBCP Property -->
<property value="select count(*) from dual"
name="Pool.ValidationQuery"/>
<property value="true" name="Pool.LogAbandoned"/>
<property value="false" name="Pool.RemoveAbandoned"/>
<property value="50000"
name="Pool.RemoveAbandonedTimeout"/>
</dataSource>
</transactionManager>
With above transactionManager definition, fixedString JDBC connection property
does not set to true and CHAR type compare problem occured again.
Could you please help me to solve this problem?
Regards,
Sukhyung Lee
Inzent Co., Ltd
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira