question

MukeshGupta-1553 avatar image
0 Votes"
MukeshGupta-1553 asked ErlandSommarskog commented

Browser Error : Calling REST API from Sql Server

Exec sp_OAMethod @Token,'Send' is throwing an error "We're sorry your current browser version is not supported".

I have setup Chrome as the default browser in the server but SQL SERVER still trying to access the API through IE.

How can I change the default browser for the sql server to go to Chrome and not IE.

sql-server-transact-sql
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MukeshGupta-1553 avatar image
0 Votes"
MukeshGupta-1553 answered ErlandSommarskog commented

Thanks guys. None of the answers posted helped me with the solution but thanks for your time.
Looks like there is no solution to change the default browser that Sql Server connects to.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MukeshGupta-1553,

Thanks for your update.

You could post a new question in REST API related forums and you may get more professional help from many experts.

But as you found, there might be no solution to change the default browser right now but in the near future you could try with new versions.

Best regards,
Melissa

0 Votes 0 ·

Looks like there is no solution to change the default browser that Sql Server connects to.

Permit me to point out that you may have a mindset problem here. SQL Server does not connect to a browser. SQL Server does not even know that it is connecting to a REST API. All SQL Server knows is that you are calling a COM method. What that COM method does - SQL Server has no clue.

As Melissa suggests, you will need to find a place where they discuss REST calls in COM. This may be difficult, since this is very old technology.

I repeat my recommendation that you should use the CLR instead. I did a quick Goggle, and found some links for your:
https://www.c-sharpcorner.com/article/calling-rest-api-service-from-sql-server-using-c-sharp-sql-clr/
https://www.sqlservercentral.com/articles/http-requests-using-sqlclr
https://stackoverflow.com/questions/50969042/consuming-rest-api-via-sqlclr-and-sending-result-via-sqlpipe

0 Votes 0 ·
ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

You might have set up Chrome as the default browser for some users on the server, but not for the service account for SQL Server. That is, default application is a per-user setting, not a machine-wide seting.

And in the end it may not help, because the COM objects may be hard-wired to Internet Explorer. You are not exactly using modern software.

I would recommend you that you first give it thought whether you should make REST calls from SQL Server at all. It is after all, something which is quite outside the core business of SQL Server.

Then again, I will need to confess that in the system I mainly work with, we do all REST calls through SQL Server, because that way we could have one single place for REST calls. However, we are not using sp_OAxxxx and old and dusty COM methods, but instead we have a CLR stored proedure, which is a little more reliable.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MelissaMa-msft avatar image
0 Votes"
MelissaMa-msft answered

Hi @MukeshGupta-1553

Welcome to Microsoft Q&A!

It is recommended to provide more details about your API and how to call this API.

Please check whether Chrome is set as default browser successfully.

You could try to upgrade your Chrome to latest version or download one version which is compatible.

If it is still not working, you have to use IE instead.

In addition, you could also try to use CLR Stored procedure SQL-APIConsumer which may be easier.

Best regards,
Melissa


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.