Kbase 19900: java.sql.SQLException: [JDBC Progress Driver]:6000 on AIX
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
FACT(s) (Environment):
IBM AIX 4.3
Progress 9.1A
SYMPTOM(s):
User is changing the SQL type within a PreparedStatement call.
JDBC SQL-92 Driver is being used.
java.sql.SQLException: [JDBC Progress Driver]:6000 on AIX
CAUSE:
Assigning a null value with the method: PreparedStatement.setNull(2,3);
and within the same loop, setting a java.math.BigDecimal with a method call like:
PreparedStatement.setBigDecimal(2,new BigDecimal("777.77"));
causes the error because SQL type 3 is decimal and therefore different from BigDecimal.
FIX:
Use the following method: PreparedStatement.setObject(int, Object, int)
where the third parameter is the target SQL type and for the specific case the same integer value as the second using with PreparedStatement.setNull(int, int)
seems to force the right SQL type. Tests show that within the above example a code like:
setObject(2,new BigDecimal("777.77"),3)
works well.