Jeff Butler <dhscn06 <at> cstone.dhs.state.il.us> writes: > > Do you mean that in straight JDBC you call registerOutputParameter > without specifying the scale? > > If so, then I'm back to being stumped. > > Jeff Butler > > >>> shilpa.pradhan <at> judiciary.state.nj.us 07/27/05 1:00 PM >>> > Jeff Butler <dhscn06 <at> cstone.dhs.state.il.us> writes: > > > > > Unfortunately, I think this could be an iBATIS issue... > > > > In the class com.ibatis.sqlmap.engine.execution.SqlExecuter, the > method > > "registerOutputParameters" always calls the version of > > CallableStatement.registerOutputParameter that does not accept the > scale > > argument. My guess is that the DB2 driver is setting the scale to > zero > > in this case. > > > > Before we all start screaming at IBM, please note that the JavaDoc > for > > this method explicitly states that this method should not be used in > the > > case of DECIMAL and NUMERIC types. > > > > Here's a link to the JavaDoc... > > > > > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html#register > > OutParameter(java.lang.String, > > int) > > > > I'm guessing this is the problem. The solution is somewhat more > > evasive... > > > > Jeff Butler > > > > > > But I am doing same thing using normal JDBC call also. In that case I > am > getting correct value and also if I call scale() method on my > bigDecimal > Property, its returning me '2', that means, DB2 is returning me 99.44 > using > normal JDBC API, with same value object. > > Thanks for your reply, > Shilpa > >
This is now really really strange.... now this is what happening... For normal JDBC code: If I set it as cs.registerOutParameter(7,Types.DECIMAL); this will return corretly once (after I start my server) and returns me 99.11 But if I rerun my application it returns me 99 But If I change my JDBC code to cs.registerOutParameter(7,Types.DECIMAL,2); It returns correct value all time. What could be the issue? Looks like DB2 driver problem or what? In iBatis is there a way I can set scale =2 explicitly. Thanks for all your help, Shilpa