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 » INSERT fails while calling couchbase from IIB V9

Post new topic  Reply to topic
 INSERT fails while calling couchbase from IIB V9 « View previous topic :: View next topic » 
Author Message
afroz11031
PostPosted: Mon Jan 09, 2017 7:15 pm    Post subject: INSERT fails while calling couchbase from IIB V9 Reply with quote

Apprentice

Joined: 28 Jan 2014
Posts: 36

Hi,
We are using IIB v9 and integrating with couchbase server using rest API call. We are able to perform 'SELECT' query using esql but while trying to do INSERT operation it gets fail returning an error 'Invalid input parameters' from couchbase server. Below is the query which we are sending to couchbase.

INSERT INTO `travel-sample` ( KEY, VALUE )
VALUES
(
"k001",
{ "id": "01", "type": "airline"}
)
RETURNING *;

Please provide your valuable input. Please note we are using IIB v9 so do not have feasibility to use node.js (loopback connector) as this is available in IIB v10.

Thanks
Afroz
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Jan 09, 2017 11:07 pm    Post subject: Reply with quote

Jedi Council

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

A command that starts with 'INSERT' is not a query.
A query is where you ask someone or something for some information. Sorry for being a bit pedantic but these things do matter.

Can you show us the full ESQL for the query that works rather than the INSERT operation.
Also, please show us the full error/exceptionlist. You can get this using usertrace.
Just giving a small part of the error output really does not help.
Stop using the debugger and run your test with usertrace enabled. I hope you have at least a trace node in your exception handling with the output set to
Code:

${ExceptionList}

_________________
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
fjb_saper
PostPosted: Mon Jan 09, 2017 11:40 pm    Post subject: Re: INSERT fails while calling couchbase from IIB V9 Reply with quote

Grand High Poobah

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

afroz11031 wrote:
Hi,
We are using IIB v9 and integrating with couchbase server using rest API call. We are able to perform 'SELECT' query using esql but while trying to do INSERT operation it gets fail returning an error 'Invalid input parameters' from couchbase server. Below is the query which we are sending to couchbase.

Code:
INSERT INTO `travel-sample` ( KEY, VALUE )
  VALUES
  (
    "k001",
    { "id": "01", "type": "airline"}
  )
RETURNING *;


Please provide your valuable input. Please note we are using IIB v9 so do not have feasibility to use node.js (loopback connector) as this is available in IIB v10.

Thanks
Afroz

Can you please replace that snippet with
Code:
INSERT INTO `travel-sample` ( KEY, VALUE )
  VALUES
  (
    "k001",
    { "id": "01", "type", "airline"}
  )
RETURNING *;

Notice the difference here between "type" and "airline".
You seem to have mixed a JSON syntax with an ESQL syntax....
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
afroz11031
PostPosted: Tue Jan 10, 2017 1:36 am    Post subject: Reply with quote

Apprentice

Joined: 28 Jan 2014
Posts: 36

Success Scenario:
Select Operation->
Code:
  SET OutputRoot.DFDL.CouchbaseDFDL.Query.Statement = 'SELECT * FROM `travel-sample` USE KEYS "couchbase"';
 Delete Operation->
  SET OutputRoot.DFDL.CouchbaseDFDL.Query.Statement ='delete from `travel-sample`  USE KEYS "couchbase" returning *' ;


Failure Scenario:
Insert Operation->
Code:
 SET OutputRoot.DFDL.CouchbaseDFDL.Query.Statement = 'INSERT INTO `travel-sample` ( KEY, VALUE )
  VALUES
  (
    "couchbase",
    { "id": "01", "type": "airline"}
  )
RETURNING *';


Trace:
Code:
(0x01000000:Name):HTTPResponseHeader = ( ['WSRSPHDR' : 0x33bff150]
    (0x03000000:NameValue):X-Original-HTTP-Status-Line = 'HTTP/1.0 400 Bad Request' (CHARACTER)
    (0x03000000:NameValue):X-Original-HTTP-Status-Code = 400 (INTEGER)
    (0x03000000:NameValue):Content-Length              = '258' (CHARACTER)
    (0x03000000:NameValue):Content-Type                = 'application/json; version=1.6.0' (CHARACTER)
    (0x03000000:NameValue):Date                        = 'Tue, 10 Jan 2017 09:15:08 GMT' (CHARACTER)
  )
  (0x01000000:Name):BLOB               = ( ['none' : 0x33bff460]
    (0x03000000:NameValue):UnknownParserName = '' (CHARACTER)
    (0x03000000:NameValue):BLOB              = X'7b0a22726571756573744944223a202266626464353731642d613961362d343436392d383964382d623934383466663334643638222c0a226572726f
7273223a205b7b22636f6465223a333030302c226d7367223a2273796e746178206572726f72202d206174205c226b3030315c22227d5d2c0a227374617
47573223a2022666174616c222c0a226d657472696373223a207b22656c617073656454696d65223a20223536362e383936c2b573222c2265786563757
4696f6e54696d65223a20223438342e383434c2b573222c22726573756c74436f756e74223a20302c22726573756c7453697a65223a20302c226572726f7
2436f756e74223a20317d0a7d0a' (BLOB)
  )
)


Fault Response:
Code:
Content-Length: 141..X-Original-HTTP-URL: http://XXX.XX.XX.XX:XXXX/XXXX'
..Content-Type: text/xml;charset=UTF-8..Host: 172.27.26.17:8093
..SOAPAction: "".
...HTTP/1.0 400 Bad Request
..Content-Length: 258
..Content-Type: application/json; version=1.6.0.
.Date: Tue, 10 Jan 2017 09:09:42 GMT.
...{."requestID": "4e64f7f0-3442-479c-bd76-473e544b29b5",."
errors": [{"code":3000,"msg":"syntax error - at \"couchbase\""}],
."status": "fatal",."metrics": {"elapsedTime": "726.916µs",
"executionTime": "642.753µs",
"resultCount": 0,"resultSize": 0,"errorCount": 1}.}.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 10, 2017 9:54 pm    Post subject: Reply with quote

Grand High Poobah

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

You are sure you are correctly defining one or more key, value pairs in your ESQL? Seems to me you'd need to do it a little differently...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
afroz11031
PostPosted: Tue Jan 10, 2017 11:01 pm    Post subject: Reply with quote

Apprentice

Joined: 28 Jan 2014
Posts: 36

Yes that is the sample message which I took it from google. Surprise to see that when we trigger the request from SOAPUI, it gives a valid success response. Not sure what and where the request message went wrong when we trigger the request from application flows.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jan 11, 2017 4:08 am    Post subject: Reply with quote

Grand High Poobah

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

SoapUI may send a REST request to cloudant, you are trying to achieve an ESQL insert. Those are certainly not equivalent!

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Jan 11, 2017 6:25 am    Post subject: Reply with quote

Grand High Poobah

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

afroz11031 wrote:
Not sure what and where the request message went wrong when we trigger the request from application flows.


How about it wasn't sent as a service call but as a database insert???

I agree with my associate; you're asking why your fried fish is fine when you cook it in hot oil, but the same fish doesn't taste the same way when you boil it.

If it works from SoapUI, you clearly need to be using a REST call not an insert.


_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
afroz11031
PostPosted: Wed Jan 11, 2017 8:20 am    Post subject: Reply with quote

Apprentice

Joined: 28 Jan 2014
Posts: 36

Hi Vitor,
I have given esql code above and as well as the trace error log. Can u please let me know what is wrong with it. I am not very clear about your statement. Pease note we are using REST call to couchbase.

Thanks
Afroz
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jan 11, 2017 8:30 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Cloudant is a , you know, *cloud* based database. I don't think you can make ODBC calls to it. I think you have to make REST calls.

REST calls are HTTP Requests, not ESQL INSERT or SELECT statements.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jan 11, 2017 8:44 am    Post subject: Reply with quote

Grand High Poobah

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

afroz11031 wrote:
I have given esql code above and as well as the trace error log. Can u please let me know what is wrong with it


You're performing an INSERT.

afroz11031 wrote:
I am not very clear about your statement.


I don't understand how I can make it cleaer.

afroz11031 wrote:
Pease note we are using REST call to couchbase.


No you're not. You're using an INSERT ESQL verb. That's not how you make a REST call in IIBv9.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
afroz11031
PostPosted: Wed Jan 11, 2017 9:55 am    Post subject: Reply with quote

Apprentice

Joined: 28 Jan 2014
Posts: 36

@Vitor, Never mind , but how does it work for 'SELECT' and 'DELETE' in IIB v9 using esql and that too REST call?

I have posted my comment @Tue Jan 10, 2017 1:36 am where I have mentioned that this is working fine for 'SELECT' and 'DELETE".


Thanks
Afroz
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jan 11, 2017 10:19 am    Post subject: Reply with quote

Grand High Poobah

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

afroz11031 wrote:
how does it work for 'SELECT' and 'DELETE' in IIB v9 using esql and that too REST call?


Blind luck?

The only supported databases for an ESQL data source are the ones for which IBM supplies ODBC drivers - IBM does not supply a Cloudant ODCB driver. I assume therefore that you're using a non-IBM, vendor supplied ODBC which is unsupported and (apparently) partially compatible with IIB.

afroz11031 wrote:
I have posted my comment @Tue Jan 10, 2017 1:36 am where I have mentioned that this is working fine for 'SELECT' and 'DELETE".


I could mention that I'm the King of England & France, and ask why I'm not King of Germany.

Post ESQL and trace (especially ODBC rather than broker trace) of the 2 successful and one failed operation.

I observe here that the ODBC drivers (which you may or may not be using) are at 3.8, which is probably a higher level that IIBv9 supports and may be a cause of your woes. The ODBC trace will tell the tale.

In any event, you'll be in an unsupported configuration even if you figure out how to get it working. Use REST.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » INSERT fails while calling couchbase from IIB V9
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.