• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting strange exception while executing preparedStatement.  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there
We are getting the following exception when the following prepared Statement is executed.

We'r using EJB and DB2ConnectionPoolDatasource to interact with Database.
javax.ejb.FinderException: com.ibm.ejs.persitence.EnumeratorException
original exception:
com.ibm.ejs.container.ContainerInternalError: ; nested exception is:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0114E An invalid datetime format was detected; that is, an invalid string representation or value was specified. SQLSTATE=22007
When we fired the same query as mentioned above from the db2 command center we could fetch the records. It looks like the query is correct. We couldn't figure out what is going wrong. Please suggest.
Thanks in advance.
regards
abhilesh
[ November 09, 2002: Message edited by: Abhilesh Khatri ]
 
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, is this EXACTLY the text of the prepared statement as it is given, or were you using variable substitution (?) on any of the date-time values?
Kyle
 
Abhilesh Khatri
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle
We tried in both ways i.e. Static query as well as variable substitution method. To make it more clear, below is the code that we tried for these two options. Please have a look into it.
1. Working with Static Query (?):
Takes a Fully Qualified SQL query and just creates a prepared stmt from it.

2. Working with variable substitution (?):
The below method expects raw SQL, param vector( in sequence) and String whose each character maps to a TYPE of the passed parameters.

Hope this helps.
We also have other finder methods that doesn't support nested select queries and these methods are working fine.
I don't know If there is something which is related to nested query? But Still the same query is working on DB2 Command Center. Isn't it strange?

regards
abhilesh
[ November 07, 2002: Message edited by: Abhilesh Khatri ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
remove the 'as' keyword in the select columns of your query
 
Abhilesh Khatri
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by kirangkp:
remove the 'as' keyword in the select columns of your query



Yes, its working by removing the AS keyword.
Thanks for the help.
Thank you all.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!