File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes illegalArgument exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "illegalArgument exception" Watch "illegalArgument exception" New topic

illegalArgument exception

Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Hi all,

Please suggest some solution for this query -

a column in a table of TIMESTAMP datatype.

i am fetching information through jdbc

but getting this exception message

Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
at java.sql.Timestamp.valueOf(
at oracle.jdbc.driver.OracleStatement.getTimestampValue(
at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(
at oracle.jdbc.driver.OracleResultSet.getTimestamp(
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getTimestamp(
... 34 more
krishnamoorthy kitcha
Ranch Hand

Joined: Feb 04, 2006
Posts: 96
Dear Tweety Samuel

In the default it returns the string type

Do not use like this rs.getTimeStamp(columnName)

just invoke this

String date=rs.getString(Columnname);

then type cast for date format like

java.text.SimpleDateFormat df= new java.text.SimpleDateFormat("yyyy-mm-dd HH:ss");

java.text.SimpleDateFormat def= new java.text.SimpleDateFormat("dd/mm/yyyy");

date = df.parse(def.format(date));

Check and tell me your feedback.
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Thanks for the reply!!!

I have found the solution of my problem. Actually, intended format was not set in the database. nls_format for session altered. now its working.

I agree. Here's the link:
subject: illegalArgument exception
It's not a secret anymore!