jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Selecting * and specific sysdate format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Selecting * and specific sysdate format" Watch "Selecting * and specific sysdate format" New topic

Selecting * and specific sysdate format

Patrick Ferguson
Ranch Hand

Joined: Jun 15, 2004
Posts: 30
Hello everyone.

I have a situation that I'm unfamiliar with and you guys always do a great job of helping out.

I'm writing a dynamic file sync system based on multiple tables in a database. These tables do NOT have the same column structure so I have to use "Select * from...", BUT I need one of the columns which is a date and is present in every table to come back with the date AND time. Currently it only comes back with the date(yyyy-mm-dd). I know the time is in there because I can see it. But when I select it into my java program it only has the date.

I know I could specifiy the columns and use a to_char function to get what I need, but you have to understand that I HAVE to use "Select * from..."

Any advice?


Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32508

You can take advantage of a feature of JDBC: use ResultSet's getTimeStamp() method. This presumes you know which column number the date type is.

If not, you could probably figure it out from the database value and then call getTimeStamp(). Note that not all drivers support getting the same column twice, but most modern drivers should be ok.

[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
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Selecting * and specific sysdate format
It's not a secret anymore!