GeeCON Prague 2014*
The moose likes JDBC and the fly likes problem with data field from db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem with data field from db" Watch "problem with data field from db" New topic
Author

problem with data field from db

Rafael Fagundes
Ranch Hand

Joined: Sep 23, 2004
Posts: 52
Hello!
I�m developping an application with MySQL db. When I try to get a data field with resultset.getDate("field"), the date it�s null (when it shouldn�t be). If i use resultset.getString("field"), the date it�s 0000-00-00. What�s thr problem? What should i do?
Thank�s for your attention.


Thanks,
Rafa
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
What would you like to do?


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the JDBC forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
what is the type of your "field". if it is Date then you should do like,

resultSet.getDate("field");

if it is String then you should do like,

resultSet.getString("field");

but it should be Date. and are you sure you have some values in your Date field?? try to get the record using some Database client tool.
 
GeeCON Prague 2014
 
subject: problem with data field from db