Results 1 to 2 of 2
- 07-14-2011, 11:22 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 20
- Rep Power
- 0
Getting exception when updating the table.
Hi,
I am using db2 database, when I am trying to update a table from java code
i.e. using preparedStatement
PreparedStatement prepStatement = conn.prepareStatement(updateValue);
prepStatement.executeUpdate();
updateValue is String which contians update sql query like "
update WEB.USER set HR_CODE = 'Rationale Acct Mgr, kind of testing the lenght of value to update the DB2 database table' where ID = '1234' "
even though the field length is 100 i.e. VARCHAR(100) in database. And length of the HR_CODE value 'Rationale Acct Mgr, kind of testing the lenght of value to update the DB2 database table' to update is 89 characters
Getting exception:
com.ibm.db2.jcc.a.SqlException: Value "Rationale Acct Mgr, kind of testing the lenght of value to " is too long.
at com.ibm.db2.jcc.c.ig.d(ig.java(Compiled Code))
at com.ibm.db2.jcc.a.kb.l(kb.java(Compiled Code))
at com.ibm.db2.jcc.a.kb.a(kb.java(Compiled Code))
at com.ibm.db2.jcc.a.w.a(w.java(Inlined Compiled Code))
at com.ibm.db2.jcc.a.ec.b(ec.java(Compiled Code))
at com.ibm.db2.jcc.c.jg.db(jg.java(Inlined Compiled Code))
at com.ibm.db2.jcc.c.jg.d(jg.java(Compiled Code))
at com.ibm.db2.jcc.c.jg.Y(jg.java(Compiled Code))
at com.ibm.db2.jcc.c.jg.executeUpdate(jg.java(Compile d Code))
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement. pmiExecuteUpdate(WSJdbcPreparedStatement.java(Comp iled Code))
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement. executeUpdate(WSJdbcPreparedStatement.java(Compile d Code))
- 07-14-2011, 06:00 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Varchar 100 bytes? or characters? I don't know about DB2, but, at least with oracle, that designation makes a difference when using a unicode character set (or another encoding that using multibyte characters), and per default it is bytes, in which case that String is 178 bytes long (if not, as in Oracle, 356 bytes long), but the field would only allow 100.
Similar Threads
-
Hyperlink on a refreshing table throws exception
By preeta in forum AWT / SwingReplies: 1Last Post: 04-12-2011, 06:55 PM -
Updating my gui
By mrx89_7 in forum New To JavaReplies: 4Last Post: 02-09-2011, 05:33 AM -
How to repaint.refresh the table (table model) with combo box selection envent
By man4ish in forum AWT / SwingReplies: 1Last Post: 01-08-2010, 06:19 AM -
Updating Displayed Table Rows
By raycini in forum JavaServer Faces (JSF)Replies: 2Last Post: 04-20-2009, 08:24 AM -
Updating database table from JTable
By yesjava in forum New To JavaReplies: 1Last Post: 08-16-2008, 10:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks