aspose file tools*
The moose likes JDBC and the fly likes CachedRowSet, populate and the date format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "CachedRowSet, populate and the date format" Watch "CachedRowSet, populate and the date format" New topic
Author

CachedRowSet, populate and the date format

Luca Luca
Greenhorn

Joined: Dec 13, 2006
Posts: 1
hi all,
look this
...
ResultSet resultset = (ResultSet) cstmt.getObject(firstOutParameter);
while (resultset.next()){
logger.info("order_date: " + resultset.getString("ORDER_DATE")); //ORDER_DATE is a Date
}
...
in this case i've something like this:
order_date: 2006-12-12 11:24:12.0

now look this
...
ResultSet resultset = (ResultSet) cstmt.getObject(firstOutParameter);
CachedRowSet rowset = new CachedRowSetImpl();
rowset.populate(resultset);
while (rowset.next()) {
logger.info("order_date: " + rowset.getString("ORDER_DATE")); //ORDER_DATE is a Date
}
...
in this case i've something like this:
order_date: 2006-12-12

??? where is the time side of th date ? is there a way to say to "populate" to fill the Date field according to my format?

any help is appreciated.

tnx,
Luca
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30925
    
158

Luca,
Welcome to JavaRanch!

Try using get timestamp instead of get string. GetString is more dependent on the driver.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: CachedRowSet, populate and the date format