Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8827085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:17:50+00:00 2026-06-14T07:17:50+00:00

I get data from oracle with result set and then populate them to cachedrowset

  • 0

I get data from oracle with result set and then populate them to cachedrowset. But when I get a date field in database and print it, it only print the date. I check the api and know that the getDate() method return java.sql.date,and time of sql.date is casted to 0. I test that if I call resultset.getString("datefield"), it can get whole date and time data, so is there any way to get whole date and time data using cahcedrowset, thanks

here’s my source code

    CachedRowSet rs = null;
    try {
    rs = executeQuery("select * from t_web_order_result ");
    if (rs != null && rs.next()) {
            KKLog.info(rs.getDate("stime"));//2012-04-24,it should be 2012-04-24 09:23:33
        KKLog.info(rs.getString("stime"));
    }
    } catch (SQLException e) {
        logErr("queryCheckers Err", e);
    } finally {
        closeCachedRowset(rs);
    }

executeQuery method

    CachedRowSet rowset = null;
    Connection connection = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
    try {
        connection = getConnection();
        statement = connection.prepareStatement(sql);
        for (int i = 0; i < params.length; i ++) {
            statement.setObject(i + 1, params[i]);
        }
        rs = statement.executeQuery();
        rowset = new CachedRowSetImpl();
        rowset.populate(rs);
        rs.close();
        statement.close();
    } finally {
         //close....            
    }
    return rowset;

i used three method to print the log

    KKLog.info(rs.getDate("stime"));
    KKLog.info(rs.getString("stime"));
    KKLog.info(rs.getTimestamp("stime"));

and the log content is

    12-11-11 17:06:11 2012-04-24 
    12-11-11 17:06:11 2012-04-24 
    12-11-11 17:06:11 2012-04-24 00:00:00.0 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:17:51+00:00Added an answer on June 14, 2026 at 7:17 am

    If you want to get the date and time from database, you have to use

    KKLog.info(rs.getTimestamp("stime"))
    

    This will give both date and time from table provided date and time is stored as date data type or as timestamp .
    Also note that you have to use java.sql.Date instead of java.util.Date.

    Update 1

    There are some bugs associated with getting time part from database if cachedrowset is used.

    I tried using CachedRowSet and time part was missing. In order to resolve this issue, add the following in the database connection part. I could see the time part as well.

        java.util.Properties prop = new java.util.Properties();
        prop.put("oracle.jdbc.V8Compatible", "true"); 
        prop.put("user", "user");
        prop.put("password", "password");
       Connection conn = 
      DriverManager.getConnection("jdbc:oracle:thin:@server:port:SID",prop);    
    

    Adding
    prop.put("oracle.jdbc.V8Compatible", "true"); is the key in resolving this issue.

    My date and time before

    2012-11-08 00:00:00
    

    After adding V8Compatible

    2012-11-08 13:28:35
    

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I' trying to get some data from Oracle via ODBC to mySQL database. And
I have to get data from Oracle Table in which I have one datefield
How get data from mysql database? I use ASP.NET and C#.Previously, I used LINQ
I want to get data from mysql database with the help of DataImportHandler so
This data comes from an Oracle database and is extracted to flatfiles in encoding
I have to get the records from a table field where Length of record/data/string
I have a query in oracle to fetch data from table using rownum but
Is there any simple way to get amount of data transferred from database to
I get data from a 3rd party API that just gives me back a
I get data from server: store = new dojox.data.QueryReadStore({url:http://url_with_data}); ... myGrid = new dojox.grid.DataGrid({id:myGrid2,selectionMode:none,style:height:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.