Author |
Message
|
ghoshly |
Posted: Wed Aug 14, 2013 7:28 am Post subject: Event creation time format - Windows / AIX |
|
|
Partisan
Joined: 10 Jan 2008 Posts: 333
|
Hi,
According to WMBEvent.xsd, Event creationTime should be
Code: |
<xsd:attribute name="creationTime" type="xsd:dateTime" use="required"/> |
In AIX environment I use mentioned below code and it works fine.
"
Code: |
SET CH_Event_Creation_Time = CAST(CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'') AS TIMESTAMP FORMAT 'IU'); |
In windows environment I could see it as "2013-08-14T14:24:03.292Z hence errored out with "subParse failed" error.
Is it is different environment wise, or I am missing something? Please help.
WMB 8.0.0.2 |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Aug 14, 2013 7:34 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
You are setting and casting at the same time. Simplify your code, and your error will go away. Think in simple terms. Lego building block terms. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
ghoshly |
Posted: Wed Aug 14, 2013 7:38 am Post subject: Formatting to store in table |
|
|
Partisan
Joined: 10 Jan 2008 Posts: 333
|
I am formatting the time stamp format to store it into a Oracle Timestamp(6) column in its local timezone. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Aug 14, 2013 7:41 am Post subject: Re: Formatting to store in table |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
ghoshly wrote: |
I am formatting the time stamp format to store it into a Oracle Timestamp(6) column in its local timezone. |
You ask 'please help' and when advice is offered, you breeze right past it without a second thought.
Don't ask for help if you don't intend to consider the advice.
The advice is : simplify your ESQL statement. It is currently a compound statement. Break it apart into discrete steps. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Aug 14, 2013 8:22 am Post subject: Re: Formatting to store in table |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
The advice is : simplify your ESQL statement. It is currently a compound statement. Break it apart into discrete steps. |
Of course, none of the parts do the right thing, so breaking it into discrete parts won't change that.
It'll just make it easier to tell that all of the parts are doing the wrong thing.
FORMAT is only used when casting TO or FROM *strings*.
I've no idea what ghosly is actually trying to do. It doesn't seem to make any sense at all. |
|
Back to top |
|
 |
ghoshly |
Posted: Wed Aug 14, 2013 8:24 am Post subject: Code Update |
|
|
Partisan
Joined: 10 Jan 2008 Posts: 333
|
I tried to update the code as below as per your suggestion
Code: |
SET CH_A = CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm s.SSS''Z''');
SET CH_Event_Creation_Time = CAST(CH_A AS TIMESTAMP FORMAT 'IU'); |
but this throws an exception as 'Unable to identify date or time I/T pattern'
However
Code: |
SET CH_Event_Creation_Time = CAST(CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm s.SSS''Z''')AS TIMESTAMP FORMAT 'IU'); |
works fine in windows.
So, my earlier question: Does the eventCreation timestamp format is different in Windows and AIX ? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Aug 14, 2013 8:30 am Post subject: Re: Code Update |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ghoshly wrote: |
So, my earlier question: Does the eventCreation timestamp format is different in Windows and AIX ? |
No.
And your code shouldn't work on Windows.
And you shouldn't need to do this to go from an xsd:datetime to an Oracle timestamp _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Aug 14, 2013 8:35 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
This is a known problem - the creationTime attribute in a monitoring event is formatted differently on AIX.
This will be fixed - the product is intended to operate in a platform-independent manner as far as that is achievable. In the mean time it is easy enough to work around the difference. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Aug 14, 2013 8:37 am Post subject: Re: Formatting to store in table |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mqjeff wrote: |
lancelotlinc wrote: |
The advice is : simplify your ESQL statement. It is currently a compound statement. Break it apart into discrete steps. |
Of course, none of the parts do the right thing, so breaking it into discrete parts won't change that.
It'll just make it easier to tell that all of the parts are doing the wrong thing.
FORMAT is only used when casting TO or FROM *strings*.
I've no idea what ghosly is actually trying to do. It doesn't seem to make any sense at all. |
It'll just make it easier to tell that all of the parts are doing the wrong thing.
Ah ha ....
W-O-R-D _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Wed Aug 14, 2013 8:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
This is a known problem - the creationTime attribute in a monitoring event is formatted differently on AIX. |
Explains why I've never had to do this on Windows, HP-UX or Solaris...
Things you learn....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ghoshly |
Posted: Wed Aug 14, 2013 8:55 am Post subject: |
|
|
Partisan
Joined: 10 Jan 2008 Posts: 333
|
Thanks a lot Kimbert !
It was not known to me and hence I could get so many different comments. |
|
Back to top |
|
 |
Simbu |
Posted: Wed Aug 14, 2013 9:16 am Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
ghoshly wrote: |
I tried to update the code as below as per your suggestion
Code: |
SET CH_A = CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm s.SSS''Z''');
SET CH_Event_Creation_Time = CAST(CH_A AS TIMESTAMP FORMAT 'IU'); |
but this throws an exception as 'Unable to identify date or time I/T pattern'
However
Code: |
SET CH_Event_Creation_Time = CAST(CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm s.SSS''Z''')AS TIMESTAMP FORMAT 'IU'); |
works fine in windows.
So, my earlier question: Does the eventCreation timestamp format is different in Windows and AIX ? |
Try below code in AIX and use broker property - Family to differentiate WINDOWS and UNIX to make your code work in both environments.
Code: |
DECLARE pattern CHARACTER 'yyyy-MM-dd HH:mm:ss.SSSZZZ';
CAST(ref_eventData.wmb:eventSequence.wmb:creationTime AS TIMESTAMP FORMAT pattern); |
|
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Aug 14, 2013 9:19 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Simbu wrote: |
ghoshly wrote: |
I tried to update the code as below as per your suggestion
Code: |
SET CH_A = CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm s.SSS''Z''');
SET CH_Event_Creation_Time = CAST(CH_A AS TIMESTAMP FORMAT 'IU'); |
but this throws an exception as 'Unable to identify date or time I/T pattern'
However
Code: |
SET CH_Event_Creation_Time = CAST(CAST(CH_Event_Creation_Time AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm s.SSS''Z''')AS TIMESTAMP FORMAT 'IU'); |
works fine in windows.
So, my earlier question: Does the eventCreation timestamp format is different in Windows and AIX ? |
Try below code in AIX and use broker property - Family to differentiate WINDOWS and UNIX to make your code work in both environments.
Code: |
DECLARE pattern CHARACTER 'yyyy-MM-dd HH:mm:ss.SSSZZZ';
CAST(ref_eventData.wmb:eventSequence.wmb:creationTime AS TIMESTAMP FORMAT pattern); |
|
That's great Simbu. Now the OP does not have to solve the problem himself and therefore becomes further dependent on people like you who will run Google queries for them.
Can you not let people learn a lesson and work through problems so they actually learn how to fish ? Why feed a needy person a fish every day when you can teach them a self-sustaining skill ?
In addition to that, following your advice, the code is not OS-independent. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Simbu |
Posted: Wed Aug 14, 2013 9:37 am Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
lancelotlinc wrote: |
Can you not let people learn a lesson and work through problems so they actually learn how to fish ? Why feed a needy person a fish every day when you can teach them a self-sustaining skill ?
In addition to that, following your advice, the code is not OS-independent. |
I take your comment as advice and will rectify it.
Yes, the code is not OS-independent and just a workaround for this issue. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Aug 14, 2013 9:43 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Simbu wrote: |
lancelotlinc wrote: |
Can you not let people learn a lesson and work through problems so they actually learn how to fish ? Why feed a needy person a fish every day when you can teach them a self-sustaining skill ?
In addition to that, following your advice, the code is not OS-independent. |
I take your comment as advice and will rectify it.
Yes, the code is not OS-independent and just a workaround for this issue. |
Fair enough. That's a great response. Good work. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|