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 IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff" Watch "IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff" New topic
Author

IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff

P Rk
Greenhorn

Joined: Nov 17, 2009
Posts: 2
Hi,
We are using java 1.5 to access a PL/SQL procedure on oracle 9i database (9.2) and we are facing problem with passing the date to pl/sql procedure.
Through JDBC, we have to set this to an object of a procedure whose description is
createdby VARCHAR2(20),
timestamp DATE,
commentText VARCHAR2(1000)
This is how we tried:
Object[3] obj = new Object[3];
obj[0] = ...
obj[1] = ...
obj[2] = new Timestamp(...)// java.sql.Timestamp : doesn't work
obj[2] = "2009-11-17 11:30:21.111111111" // Concatenating fractional seconds: doesn't work
obj[2] = new TIMESTAMP(date).toJdbc(); // oracle.sql.TIMESTAMP : doesn't work

We have used SimpleDateFormat and converted date to the string form and tried to pass it, but still the same error
IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff

Please help.

Regards,
PRK
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Try something like this



Regards,

Fatih.
P Rk
Greenhorn

Joined: Nov 17, 2009
Posts: 2
Thanks Fatih for the reply.

I tried with this but still the same error.
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
String format ="yyyy-MM-dd'T'HH:mm:ss.SSSZ"

Format the date using this formatter and then pass it on to the query

Hope this helps.

Thanks


Thanks,
Prabhat
SCJP 1.5, SCWCD 1.5, SCBCD 1.5
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
 
Similar Threads
SimpleDateformat
problem with Date and timestamp
Conversion of String to Date
Performence issue:Write query directly in session bean or call storted procedure
date problem not in access but sql server