How to connect Microsoft Sync SQL database to the Postman

Hi Team,
How to connect Microsoft Sync SQL database to the Postman since I need to verify dynamic values from database everytime.
So I will try below steps.

  1. Will use sql queries to retrieve data from database.
  2. Will put those values in a variable.
  3. Will verify those values with respect to the response.

Postman is an API testing tool, not a database testing tool.

If you wanted to do this, you’d have to make an API that sits on top of your database (but that’s really what an API actually is).

1 Like

Sorry @allen.helton for the delay but lets connect again.

End Goal/Requirement:
Verify the response of API through Database instead of manually retrieving the data from database and put into .csv file.
So can we connect Postman directly through database so no need to put data into .csv file. We will fetch data from database queries and will put in to variable and same variable we can put in assertion script to verify response.

Here is the database version and details, Any suggestion who we can remove those manual intervention:
image

Hi @aakashjain8693,

As @allen.helton noted, Postman uses web based HTTP API requests, meaning in Postman can interact with web based services. Database services are not the same as web based services, and therefore Postman cannot interact with a database directly. Even more specifically, Postman does not support ODBC / JDBC connections, which is used to connect to databases.

So, your best bet to test the database, and its data, is to create a web service (Web API), that supports connecting to the database and creating / reading / updating / deleting information in the database. Then you can use that API to test against the data in the database. While this is not explicit database testing, it may support what you desire.

1 Like

Thanks, Making sense.
Will update same to the dev team and go ahead with same track.

Lets bring to the Postman team so that in future they give ODBC connection facilities to the end users.

@aakashjain8693

You’re welcome! Sure you can make enhancement requests, you would do this in the RFC section of the community, if I’m not mistaken.

Personally, I do not believe Postman would integrate a feature such as this in the future, as their primary focus is around API and web based technologies. Though you are certainly free to make such a request.

It may be best to consider other tooling that you can do database tests with.

2 Likes

Thanks @allen.helton @odanylewycz

1 Like

Hi @allen.helton @odanylewycz @joyce
I was going through the database document https://documenter.getpostman.com/view/5922408/RznJmGfn where I can see author trying to connect MySQL with Postman.
Is that something you mentioned above they created the URL(web service) of your database then connecting?

Is there any reference available for developer team to create webservice/url over database?

Thanks in advance!!

Hi @aakashjain8693,

I am not sure what your are asking for, as this documentation would be be your reference for a developer team to create a quick webservice over a database. Granted, as noted in that documentation, this is not meant for production by any means, but rather a quick way to access the database via a webservice.

If you install the npm package, and run the command, you will have a webservice/url that you can use to access the data from the database, using the commands further in that documentation.

If this is not what you are looking for, please clarify more.

Best,
Orest

Yup, Thanks for the clarification. It mean we are on right track, If developer are ready with URL of the database then testing team will be on paramount :).
Is there any document where QA/Dev team can go through it and create the URL?

Last but not list, I was going through some stuff, Through the third party tool we can connect database with postman without webservice creation.
A. DreamFactory API management.
B. Apache Drill
C. Firestore API: https://firebase.google.com/docs/firestore/use-rest-api
D. Airtable API: https://airtable.com/api

Do we have any reference or the end users who already implemented?
Thanks!!!

These methods would create an API (aka webservice) to communicate with the database.

So you’re just trying to find a way to communicate with the database so you can verify that an existing API is returning proper values?

1 Like

Hi @aakashjain8693,

In terms of your document for QA/Dev team, the document you referenced earlier would be that document to go through and create the “URL”, or more so, create a web service for it. This will depend more on how you want networking to work with the webservice, if its going to be remotely accessed, or locally. If remotely, that involves work of setting up DNS services. Otherwise, you would just use the IP of the web service, so long as its exposed over the network.

I am not sure what you mean with your last question. What reference are you looking for? It seems to me you gave us references, that you would to end users. Those services most likely have API documentation on how to consume the web APIs they create over the database, that would be useful for end users, assuming they are looking to consume the web apis, do testing, etc.

Best,
Orest

1 Like

Yup, I guess this is one of the best post where you got exactly what I am needing.
Yes, I just want to verify the values from database compare to the database.
Any solid reference? Digging more into but somewhere looks like not in the right track.

To me, this is literally what an API does.

I think there is something fundamentally wrong with the processes you’re going through if you feel like this is the only way to make sure things are working.

The API you’re testing should already be connecting to the database and returning values. You shouldn’t need to implement that again to test it.

We have the APIs responses, Now we need to verify them. Those values are exactly the same what we are retrieving from the database.

As of now we are verifying them through the .csv file means manually. We run the query, getting the responses and copy/paste into .csv file.

So to avoid manual effort we need to connect database so that we can verify the data through getter/setter method.

So indirectly its Interconnected but not sure already created or not.
A. DreamFactory API management.
B. Apache Drill
Those are good option?
With he existing resource who we can go ahead?

I’d opt for a more data driven approach.

Build a workflow that tests the API works as designed.

  1. Have a POST request that adds data into the system and save the values you used
  2. Do a GET to load the data you just added
  3. Compare the GET to the values you saved from step 1

This way, tests are dynamic, simpler, and verifies the current state of the API is working.

1 Like

Hi @aakashjain8693,

Given the example you provided, your use case makes more sense now.

I personally haven’t worked with those options, but I know @vdespa has made a great video on using DreamFactory API.

Here you can make a request in your test script to pull the data you are looking for, and then to validate the data of the response of your API.

Though, given what @allen.helton just said, that is likely to be a better approach, where you have complete test data initialization, and test data tear down. This is what you see very often in the testing industry, and I would opt for his suggestion as well, as adding more services can complicate things.

If you absolutely need to do connect to a database, for different testing purposes, then feel free to watch the video above.

If we could have GET and POST both methods then it was amazing But unfortunately we have GET method related API only.
And dev team have no bandwidth//approval/costing to create POST APIs.

Anything else?

Thanks for the amazing quick response.
I already following dream factory approach but two major issues as below:

  1. Paid tool
  2. Not supporting MS SQL server 2014 Databse(our current database).

How does data get into the system?