This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 and Relational Databases
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: 32481
    
214

Luca,
Welcome to JavaRanch!

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


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
 
Have you checked out Aspose?
 
subject: CachedRowSet, populate and the date format
 
It's not a secret anymore!