This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Mapping Oracle DATE to java.sql.Date ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Mapping Oracle DATE to java.sql.Date ?" Watch "Mapping Oracle DATE to java.sql.Date ?" New topic
Author

Mapping Oracle DATE to java.sql.Date ?

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi I am getting inconsistent results in the the mapping.
Im the Oracle table, I have a date field which I retrieve using j2sdk1.4 getDate() method. Here is the code snippet from the applet :
[code]
...
import java.util.Date;
...
showHireDate(thisEmpRec.hiredate, HireDate);
...
public void showHireDate(Date hiredate, TextField HireDate)
{ HireDate.setText(hiredate.getDate() + "-" +
hiredate.getMonth() + "-" +
hiredate.getYear());
}
Sometimes, I get the correct display e.g. 21-12-91
Othertimes, I get odd results e.g. 21-7-102
I know it is deprecated, but it should work...


humanum errare est.
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Wrong forum again, Dirk moves me around so fast I get dizzy.
I tried something new, but get my typical "cannot resolve symbol" error:

javac throws this error
cannot resolve symbol
symbol : method myDateFormat (java.util.Date)
location : class java.text.SimpleDateFormat
return formattedDate.myDateFormat(inputDate);
^

One would think I should get the hang of JAVA after 4 months of JAVA-ing, but, no...
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi.
I spotted the error, should be

Thanks anyway.
 
Don't get me started about those stupid light bulbs.
 
subject: Mapping Oracle DATE to java.sql.Date ?