• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

illegalArgument exception

 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic