ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Long to Date from JavaCompute node issue

Post new topic  Reply to topic
 Long to Date from JavaCompute node issue « View previous topic :: View next topic » 
Author Message
EAI Developer
PostPosted: Fri Mar 23, 2012 7:05 am    Post subject: Long to Date from JavaCompute node issue Reply with quote

Centurion

Joined: 30 Nov 2005
Posts: 101
Location: US

Hi All,
I am trying to convert long datatype to date format, after taking the value from global env. Once done, I am sending the same value to DB utility(custom), which will insert the details in DB.

Out of 1000 calls to DB util, 12-18 calls are failing throwing the below error : java.sql.BatchUpdateException: ORA-01843: not a valid month.

After some investigation, I found that, my application code, is not generating date format intermittently, not sure about the reason.

Code:


EnvironmentUtil envUtil = new EnvironmentUtil(globalEnv);
lReqDateTime = Long.parseLong(envUtil.getTimeStamp().trim()); - Needed to get the response time ( Response timestamp - Request timestamp)
Date dReqDateTime = new Date(lReqDateTime);
SimpleDateFormat sdFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
   
sReqDateTime = sdFormat.format(dReqDateTime);

 where env.setTimeStamp(Long.toString(System.currentTimeMillis())); which will put timestamp in global env.


_________________
___________________
Regards,
EAI Developer.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Fri Mar 23, 2012 7:18 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Clearly it's a bug in your code.

However, you didn't show enough of the code to understand where.

Have you been able to isolate anything about the data that is not properly generating a date?

Have you mixed up 'mm' and 'MM'?
Back to top
View user's profile Send private message
EAI Developer
PostPosted: Fri Mar 23, 2012 8:01 am    Post subject: Reply with quote

Centurion

Joined: 30 Nov 2005
Posts: 101
Location: US

Hi mqJeff,

I could not find any pattern out of it. its random. Below are few dates for which long to date format is not happening.

Code:


1330588571721 - > 03.01.2012 07:56:12 AM
1332258857446 - > 03.20.2012 03:54:17 PM



If the call fails , it would have been easy for me. but it works 90% of times.

Apart from getting timestamp and setting timestamp in environment, below is pretty much the code, which I am using. Not sure, what else will be helpful to share.

Also, public String sReqDateTime; is a string, so I am tring to put date in string, is it fine ?
_________________
___________________
Regards,
EAI Developer.
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Sat Mar 24, 2012 1:07 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

In order to better understand what is happening in the case where it fails,
we would need to have;
  • Date Time /timestamp value in normal format
  • The corresponding long format / value (the failing one)
  • The corresponding value as being stored in Environment...
  • The error text being thrown
  • The stack trace,
  • your code around the part where the exception is being thrown


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Long to Date from JavaCompute node issue
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.