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

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

 
P Rk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try something like this



Regards,

Fatih.
 
P Rk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Fatih for the reply.

I tried with this but still the same error.
 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic