Forum Discussion
Hi aly,
I never thought of using the JDBC TestStep to talk to MongoDB, quite interesting! I normally use the GMongo wrapper or MongoDB REST API instead, the GMongo Groovy TestStep option works great.
But, if I was to try I think the driver class and connection string may be different if you try a raw JDBC connection e.g.
JDBC Driver class name: mongodb.jdbc.MongoDriver URL format: jdbc:mongo://<serverName>/<databaseName>
Taken from http://www.unityjdbc.com/mongojdbc/mongo_jdbc.php
Also I don't think adding the GMongo driver is necessary for the JDBC test step, as the GMongo is just a nice Groovy wrapper that the JDBC TestStep cant use - think it might just need the JDBC driver details.
Does that help?
Otherwise, using the GMongo Groovy TestStep Option is suprisingly nice e.g. something like (needs both the drivers you added)
import com.gmongo.GMongo def mongo = new GMongo('localhost:27017') def db = mongo.getDB('test') log.info db.invoices.findOne()
I have also seen other use the Mongo REST API as a service / Request TestStep option - https://docs.mongodb.org/ecosystem/tools/http-interfaces/
Hope this helps,
Rup
Incidentally,
- TesterNo19 years agoContributor
i tried and could not get it working from JDBC test step.In jDBC step, you can write groovy code to access the db.It requires gmongo jar file and mongo diver to be copied to ext folder .
- rupert_anderson9 years agoValued Contributor
Hi,
Ok, I got this update from you on the ticket:
http://screencast.com/t/WjMwVq54c
Check teh screencast.It worked for me.
Which looked cool, nice screencast to share the solution :-)
But then you edited the post with whats currently written there - so are you ok with this now? or are there still problems I can try to help with?
Thanks,
Rupert
- aly9 years agoNew Contributor
Hi,
thanks for reply. I am using opensource version so I do not have Drivers options. Where did you take this link? Maybe I can try to do the same but with Global properties option?
Related Content
- 5 years ago
- 4 years ago
Recent Discussions
- 15 years ago