my dog learned polymorphism*
The moose likes JDBC 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
Bookmark "illegalArgument exception" Watch "illegalArgument exception" New topic
Author

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
rs.getTimeStamp(columnName)

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(Timestamp.java:185)
at oracle.jdbc.driver.OracleStatement.getTimestampValue(OracleStatement.java:4776)
at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:663)
at oracle.jdbc.driver.OracleResultSet.getTimestamp(OracleResultSet.java:1625)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getTimestamp(NewProxyResultSet.java:3394)
... 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: http://aspose.com/file-tools
 
subject: illegalArgument exception
 
Similar Threads
bad Timestamp Exception
Date Mapping
Converting String to Timestamp
Exception Error Handling
Timestamp issue with %20 space.