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 » ESQL Behaviour with Database

Post new topic  Reply to topic
 ESQL Behaviour with Database « View previous topic :: View next topic » 
Author Message
Aldrine
PostPosted: Thu Feb 23, 2012 1:02 am    Post subject: ESQL Behaviour with Database Reply with quote

Novice

Joined: 25 Jul 2011
Posts: 22
Location: India

Hi Friends,

I have a Database Column with type as "NUMBER(*,0)"; which implies it would accept any data without any decimal value.

While executing the following SQL command "UPDATE tb_oka03100 SET official_employmentpercentage=96.55 WHERE wnm_nr=00106993;"from: many tools(or node) like SQL developer, ISQL, and JCN. The value of "97" is getting updated into the Database.

However while trying to achive the same via ESQL, it causes an exception:
"[IBM][ODBC Oracle Wire Protocol driver]String data, right truncated. Error in parameter 12".

When I manually handle the changes done by Database with ESQL to adapt the value; it works perfectly. Hence my question is there is any reason that we should adapt the value while using ESQL alone?
_________________
--
Aldrine Einsteen
Back to top
View user's profile Send private message
vishnurajnr
PostPosted: Thu Feb 23, 2012 1:50 am    Post subject: Reply with quote

Centurion

Joined: 08 Aug 2011
Posts: 134
Location: Trivandrum

Use PASSTHRU to write ESQL statements that:

Bypass the WebSphere Business Integration Message Broker Parser
Go straight to the configured backend database
Execute a coded statement
Back to top
View user's profile Send private message Visit poster's website
Aldrine
PostPosted: Thu Feb 23, 2012 1:54 am    Post subject: Reply with quote

Novice

Joined: 25 Jul 2011
Posts: 22
Location: India

vishnurajnr wrote:
Use PASSTHRU to write ESQL statements that:

Bypass the WebSphere Business Integration Message Broker Parser
Go straight to the configured backend database
Execute a coded statement


Hi vishnurajnr,

I have already tried both using UPDATE/INSERT statement and PASSTHRU; Both results in the same Exception.
_________________
--
Aldrine Einsteen
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Thu Feb 23, 2012 2:13 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Aldrine wrote:
I have already tried both using UPDATE/INSERT statement and PASSTHRU; Both results in the same Exception.


Develop your SQL statements with a DB-Tool (TOAD, SQLDeveloper) and put the statement into ESQL (when it works) as a string. Also check this post here.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Feb 23, 2012 5:06 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

I seem to recall have a problem like this once.
I think I solved it by casting the value as a FLOAT and passing it to a stored proc to do the insert. This was some time ago so I might be wrong.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Aldrine
PostPosted: Thu Feb 23, 2012 5:28 am    Post subject: Reply with quote

Novice

Joined: 25 Jul 2011
Posts: 22
Location: India

@mqsiuser : As you can see in my first post itself I have tested with PASSTHRU too; but resulted in the same Exception.

@smdavies99: Indeed its the developer should take care of type castings in all programming languages and I never complain about it.
But its about the precision and scale, which is automatically taken care by the DB/Driver for eGate, WMB JDBC and other tools but why not for ESQL?
_________________
--
Aldrine Einsteen
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Thu Feb 23, 2012 5:48 am    Post subject: Re: ESQL Behaviour with Database Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

I'd say that is not a bug, its a feature (of ESQL) (to be stricter, than your tools).
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
adubya
PostPosted: Thu Feb 23, 2012 5:55 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

Well as you're attempting to put incompatible data into the table column then I'm not surprised an error is returned. The fact that other DB drivers/tools perform differently is academic. Convert your data in ESQL to a compatible data type and everyone's happy
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Feb 23, 2012 5:55 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Aldrine wrote:
But its about the precision and scale, which is automatically taken care by the DB/Driver for eGate, WMB JDBC and other tools but why not for ESQL?


Because e*Gate uses it's own method for accessing a database (IIRC it uses JDBC now as well), WMB JDBC is JDBC and ESQL is using ODBC. So different database drivers react in different ways.

My question is this: how do you know from a business standpoint that it's correct for 96.55 to be rounded up and stored as 97? How do you know in any given case it shouldn't be rounded down to 96?

This isn't the sort of thing I'd be happy leaving to a piece of driver software to work out. I'd prefer some visible rules on this in code somewhere.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Feb 23, 2012 5:58 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

War story - financial application I worked on stored integer values but they had to be rounded to the higher even number. So 96.55 became 98.

Don't ask me why, I never got a straight answer just a white board full of actuarial formulas proving conclusively that this had to be done. Apparently.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Feb 23, 2012 6:03 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
War story - financial application I worked on stored integer values but they had to be rounded to the higher even number. So 96.55 became 98.


Off by two, instead of off by one?

The British must be coming by sea, instead of land.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ESQL Behaviour with Database
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.