Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why this OverFlow error during updating?

 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am just trying to update a record in my table. I am using the following:-
1.Windows 2000
2. Microsoft SQL 7.0
3. Java 1.3
4. "cd" field is of datetime data type
The following program gives me error:

D:\>java SetAppDate
Error in SetAppDate: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]D
atetime field overflow

Could u please help me to sort this issue?
regards,
Arun
 
Paulo Salgado
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun,
I've done that successfully using DB2. The driver converted the java.sql.Timestamp into the TIMESTAMP column as expected. You may want to print the stack trace to make sure the source of the error is the driver and if that's the case, look for bug/limitations info and/or try another (if any) driver available for SQLServer.
Good luck.
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Timestamp sdt = new Timestamp(1980,1,1,0,0,0,0) --> This is a deprecated constructor. Try using the 'public Timestamp(long time)' constructor instead. It may or may not have contributed to your problem.
Jamie
 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
1. I don't think there is any driver limitation as I could easily use this for my other query. SO driver limitation for Timestamp is out of question.
2. As far as the Deprecated method is concern I again don't see any reason with it. My objective here was to put a date explicitly here so thought of this method.
Ok but will try your suggestions or perhaps looks for the other methods which are not deprecated and update you.
Anyway thanks a lot for the support.
regards,
arun
 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I got it corrected. It was a deprecated method which was giving trouble. I was wrong. Thanks for the support. Posting the code if someone is inerested.
regards,
arun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic