OraclePreparedStatement的问题!
今天在
String sql = "insert into TMP_PERSON (CODE, NAME) values(SEQ_TMP_PERSON.NEXTVAL, ?)";
conn = ConnPool.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,person.getName());
报了ORA-01461: can bind a LONG value only for insert into a LONG column个异常。
发现是在绑定person.getName()的时候抛出的
但又不知道怎么解决,希望能有人解答,谢谢!
或者给我OraclePreparedStatement的源码也行!谢谢!
今天在
String sql = "insert into TMP_PERSON (CODE, NAME) values(SEQ_TMP_PERSON.NEXTVAL, ?)";
conn = ConnPool.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,person.getName());
报了ORA-01461: can bind a LONG value only for insert into a LONG column个异常。
发现是在绑定person.getName()的时候抛出的
但又不知道怎么解决,希望能有人解答,谢谢!
或者给我OraclePreparedStatement的源码也行!谢谢!
肯定不是数据库设的LONG型而插入的不是此类型或插入大数据量的问题。
我只插入了两个日文字,而且一直传到插入前还不是乱码。
The NLS_LANG parameter is <language>_<territory>. <Characterset>
NLS_LANG=<NLS_LANGUAGE>_<NLS_TERRITORY>.<NLS_CHARACTERSET>
The OST4 Oracle9i has been set up with UTF8 character set. Its NLS_LANG parameter is AMERICAN_AMERICA.UTF8. However the NLS_LANG parameter for the Oracle clients on dev03 or our local machine was not set with this value. On setting NLS_LANG parameter to AMERICAN_AMERICA.UTF8 on client side, the issue got resolved.
To set NLS_LANG on Windows check the following entry in the registry: HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/NLS_LANG. On Unix NLS_LANG is set as a local environment variable.