Ask a Question

Mongo Db query not working in JDBC TestSTep of Ready API

shubhimu
Contributor

Mongo Db query not working in JDBC TestSTep of Ready API

Hi,

 

I am able to connect to mongo db after placing the mongodb_unityjdbc_full driver in ext folder.

But i am not sure how i can run query from jdbc test step.

I tried following the mongo db syntax but its throwing below errror message:

2018-12-26 07:25:54.543 - Error getting response; java.sql.SQLException: Parse Exception: unity.parser.ParseException: Encountered " "(" "( "" at line 1, column 17.
Was expecting:
";" ...
Input query: db.customer.find({leadId:"83863270"},
{accountState:1,leadId:1,_id:0});

 

Can someone please help me how i can place query under sql query section of jdbc test step for mongo db ?. Please see the image for your reference

3 REPLIES 3
richie
Community Hero

Hey,

In the absence of any other responses im gonna respond but i cant really help as i have minimal nosql db experience.

The response youre getting appears to indicate it doesnt like the syntax of your query....youre definitely connecting ok.

You appear to be using the standard collection find method. The only thing i can suggest at this point is simplyfying your query further. After a bit of reading it appears you are querying for a record with certain leadid and additional filters on your query. Have you tried the simplest query you can do? e.g. to find a record in the customer collection where leadid = "83863270"?

I'll do a bit more reading to see if i can see anything but id start at this point if i were you. Simplest query possible. I know years ago a version of soapui didnt like ; to finish an oracle query, but this was how you ended your query in oracle!


One thing. The first leadid value is being treated as a string (the double quotes) but the second leadid attribute value is treated as numeric (no double quotes wrapping the second leadid value). Is this correct?

Cheers,

Richie
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
ashu248
Contributor

@shubhimu

please try using simple sql query once test connection get success. 

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.Smiley Wink

TanyaYatskovska
SmartBear Alumni (Retired)

Hi @shubhimu,

 

Did any suggestions help you? Please give Kudos to their authors and accept a solution if the question is resolved.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: