|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Long to Date from JavaCompute node issue |
« View previous topic :: View next topic » |
Author |
Message
|
EAI Developer |
Posted: Fri Mar 23, 2012 7:05 am Post subject: Long to Date from JavaCompute node issue |
|
|
 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 |
|
 |
mqjeff |
Posted: Fri Mar 23, 2012 7:18 am Post subject: |
|
|
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 |
|
 |
EAI Developer |
Posted: Fri Mar 23, 2012 8:01 am Post subject: |
|
|
 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 |
|
 |
fjb_saper |
Posted: Sat Mar 24, 2012 1:07 pm Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|