File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with data field from db
 
Similar Threads
Interesting TimeZone issue
unable to retrieve timestamp in my servlet
unable to retrieve timestamp in my servlet
SimpleDateFormatter shows wrong hour?
Date & Time