[
https://issues.apache.org/jira/browse/IBATIS-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637434#action_12637434
]
Giovanni Cuccu commented on IBATIS-541:
---------------------------------------
I think I provided a patch for tihs issue in another one see:
https://issues.apache.org/jira/browse/IBATIS-528
> NCHAR, NVARCHAR Oracle support
> ------------------------------
>
> Key: IBATIS-541
> URL: https://issues.apache.org/jira/browse/IBATIS-541
> Project: iBatis for Java
> Issue Type: Wish
> Components: SQL Maps
> Reporter: Denis Nelubin
> Priority: Minor
>
> Oracle JDBC driver has strange support of national character data types. It's
> required to call oracle.jdbc.OraclePreparedStatement.setFormOfUse(int
> paramIndex, short formOfUse) method before calling to setString() or
> registerOutParameter() (for OracleCallableStatement). Otherwise the national
> characters will be converted to the database encoding which can cause data
> loss.
> The first form of use (on setting parameters of prepared statement) can be
> solved by such custom TypeHandler:
> import java.sql.PreparedStatement;
> import java.sql.SQLException;
> import java.sql.Statement;
> import oracle.jdbc.OraclePreparedStatement;
> import org.apache.commons.dbcp.DelegatingStatement;
> import com.ibatis.sqlmap.engine.type.StringTypeHandler;
> public class NVarcharTypeHandler extends StringTypeHandler {
> public void setParameter(PreparedStatement ps, int i, Object parameter,
> String jdbcType)
> throws SQLException {
> Statement delegate = ps;
> while (delegate instanceof DelegatingStatement) {
> delegate = ((DelegatingStatement)delegate).getDelegate();
> }
> if (delegate instanceof OraclePreparedStatement) {
> ((OraclePreparedStatement)delegate).setFormOfUse(i,
> OraclePreparedStatement.FORM_NCHAR);
> }
> ps.setString(i, ((String) parameter));
> }
> }
> But the second form of use (on registering output parameters) requires
> changes in SQL Maps control flow. There is no extension point to get access
> to CallableStatement before registering output parameters.
> I propose to extend TypeHandler interface by adding such method:
> void registerOutParameter(CallableStatement cs, int columnIndex, String
> jdbcType, Integer numbericScale)
> and modifying SqlExecutor to call this method before registering output
> parameters.
> Also it will be good to include support of this Oracle data types into base
> distribution.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.