Values getting corrupted in update

RohitVohra
2004-11-22
2013-04-11
  • RohitVohra

    RohitVohra - 2004-11-22

    Hi,

       I'm using IBatis version 2.0.3 build#333

    I'm getting a problem in update.

    When I'm updating field values with the update statement given in xml file, the values being reflected in the database (Oracle9i) are showing some special characters, and the value for these fields get currupted. The update statement is working fine when executing through console. I executed the following update statement :

    update table_name set name='ABC',fname''XYZ' where eid=132

    with hardcoding the values, but still am facing the same issue. The value updated in the name and fname fields show some different characters which leave them corrupted.

    I'm using oracle.jdbc.driver.OracleDriver.

    Plz help.

    Thanx,
    Rohit

     
    • Brandon Goodin

      Brandon Goodin - 2004-11-22

      I'm not really grasping what the scenario is. Are the "special characters" something you want? or are they something that is not supposed to be in the field? What is the desired effect and what is the current failing result? Please explain your problem a bit clearer by giving us a context into what your application is doing in this particular scenario.

       
    • RohitVohra

      RohitVohra - 2004-11-23

      The special characters are unwanted characters, which are updated in the Record.

      When updating by executing

      update table_name set name='ABCxyz', fname''XYZ'  where eid=132 

        the record gets updated with name value =
        a@qxyz. Only the varchar typo columns are getting corrupted values.

       
      • Brandon Goodin

        Brandon Goodin - 2004-11-23

        update table_name set name='ABCxyz', fname''XYZ'  where eid=132

        shouldn't fname''XYZ' be fname='XYZ'? I assume this is a typo.

        so instead of ABCxyz you are getting a@qxyz in the database after the update?

        If so... this is an odd error for sure. I've never seen any problem like this caused by IBatis itself. Could you post the code surrounding what you are trying to do (SQLMap, DAO class logic class, Action class, jsp, etc...). I would like to get a more complete picture on what is happening.

        Have you tried placing a debugger on your app to see if the value is correct before it gets to ibatis?

        Brandon

         
    • RohitVohra

      RohitVohra - 2004-11-23

      Oops..

        That was a copy mistake. The query is like :

      update table_name set name='ABCxyz', fname='XYZ' where eid=132

      One more thing, if I change the order of columns to be updated as

      update table_name set fname='XYZ', name='ABCxyz' where eid=132

          Then this query is working fine.

       
    • Brandon Goodin

      Brandon Goodin - 2004-11-23

      I am not able to provide an answer about what could possibly be going wrong. I don't really have enough information to diagnose it. I hate to be repetitive and i don't mean to be rude... but, i don't think you provided all that i asked for previously. I really want to help you resolve this. but, i need more info.

      Brandon

       
    • itsjagjit

      itsjagjit - 2004-11-26

      Hi Brandon,
      Thanx for your reply.

      Actually, we are just running update query with following entry in xml file.

      update EB_NEWSLETTER set LOCATION = #location# , LOGIN_ID = #login_id# , UPLOAD_DATE=#uploadDate# where NEWSLETTER_NAME = #newsLetterName#

      So while updating, I got ?? characters in location column. And main thing is this happens for first column mentioned in query. e.g. if I change above query to

      update EB_NEWSLETTER set
      LOGIN_ID = #login_id#,LOCATION = #location#, UPLOAD_DATE=#uploadDate# where NEWSLETTER_NAME = #newsLetterName#

      then problem occurs with login_id.
      But if I keep upload_date as first column, then this problem never happens like in following :

      update EB_NEWSLETTER set
      UPLOAD_DATE=#uploadDate#,LOGIN_ID = #login_id#,LOCATION = #location#,  where NEWSLETTER_NAME = #newsLetterName#

      I think, it's VARCHAR2 field in first column which is creating problem. We are facing this problem in all updation queries we have in our project.

      We also debug to check that all data passing to IBatis is correct.

      Please suggest.

       
      • Brandon Goodin

        Brandon Goodin - 2004-11-28

        sorry, i just got back from a thanksgiving vacation. I'll read your response and answer it after i've had some sleep.

        Brandon

         
    • Clinton Begin

      Clinton Begin - 2004-11-28

      Hi Rohit,

      It is easier and more likely that we can help you if you do the following:

      1) Upgrade to iBATIS 2.0.8 (not that it will help this particular problem, but why stay on an old release?).

      2) Post the relevant Java code, the statement XML stanza, the resultMap and parameterMap (if they apply).

      3) Your full environment:  Operating System, JDK version, Oracle driver version, Oracle version, and your locale.

      This sounds like one of two things to me:

      i)  XML encoding is set differently than databse (weird that it would affect alpha characters though).

      ii) You might be using a mismached JDBC driver for the Oracle server version.

      Cheers,
      Clinton

       
      • Clinton Begin

        Clinton Begin - 2004-11-28

        PS:  You should move this thread to the Apache mailing lists.

         
    • RohitVohra

      RohitVohra - 2004-12-01

      hi,

         The problem got resolved. It was because of different version of driver for ORACLE server.

      Thanks for ur help.

      I can't transfer it to mailing lists as it's prohibited in out company internet policy.

      Thanks,
      Rohit

       

Log in to post a comment.