Results 1 to 5 of 5
  1. #1
    juamd is offline Member
    Join Date
    Apr 2010
    Posts
    25
    Rep Power
    0

    Default Problem with CachedRowSetImpl

    Hi !!

    I am working with CachedRowSetImpl to retrieve and storage the data from database but I found a query that makes it hard: I am executing this query:

    Java Code:
    select date_add('DATE', interval 1 month)
    DATE is whatever date

    I copied and executed the query in the database and everything was fine it returns a string like 'yyyy-mm-dd' and I try to retrieve the result as follows:

    Java Code:
    while(result.next()){
            mesSiguiente = result.getString(1);
    }
    result is a CachedRowSetImpl object that storages the result of the query and mesSiguiente is a string that storages the date.

    the problem is that mesSiguiente always has something like "[B@1fd10fa", why ? I don't know

    Any suggestions ?

    Thanks.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    Possibly because DATE is actually a Date and not a String?
    Try getDate(1) instead and store it in a java.sql.Date.

    I suspect CachedRowSet has taken the output of the original reuslt set and created objects of a suitable class for each column, so a DATE becomes a Date. Not sure, though, because the toString() of a date should give yo a proper output, and not the Object default.

    Still, I'd try getDate().

  3. #3
    juamd is offline Member
    Join Date
    Apr 2010
    Posts
    25
    Rep Power
    0

    Default

    I tried with getDate but I got an error, so I wanted to prove if there was a problem retrieving the value from the query, so I changed it to

    select last_day('DATE')



    --DATE is whatever date

    and surprise it worked so the problem is the query, but why ? this query worked before but now that I'm modifying the app to work with CachedRowSetImpl it doesn't work.

    both queries work in the database and give me a similar result

    I'm gonna try to code a java method to replace the mysql function.

    Thanks.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    You really ought to post a link here to the cross post over at the Sun/Oracle forums...

  5. #5
    juamd is offline Member
    Join Date
    Apr 2010
    Posts
    25
    Rep Power
    0

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •