0

I want to find the url or host of my SQL database so that I can connect it to my node app. Currently I am using that db in my pc using SQL server management studio but I don't need the url to login in that I just enter that hostname. I am wondering where i can find the sql server url.

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • 1
    What do you mean the "URL" of the server? Server's don't have URLs. For example, `https://stackoverflow.com` is a URL, but it's not a host name and is unlikely to point to a single server, if I am honest. As for the host name, on SQL Server, just use [`HOST_NAME`](https://learn.microsoft.com/en-us/sql/t-sql/functions/host-name-transact-sql?view=sql-server-ver15) – Thom A Jun 25 '21 at 16:51
  • Okay for instance if i am using a sql db from microsoft azure they give some hostname like http://azure-portal/db/user/other-stuff.net and this i put in the db connection string to connect to database along with other things like username, pass, and db name. I tried to connect my sql on localhost using ther hostname 'oppacde-host' and its working but doesn't work on heroky deployment so there must be a host name where it points where my db is located. This is the first time I am doing it so i'm not sure what hostname to put – Edgar Spacey Jun 25 '21 at 16:55
  • to give an example for localhost const config = { server: 'OPPACUde-HOST', user: 'secret', password: 'secret', database: 'secret', trustServerCertificate: true } but it doesn't work on heroku even though it works on locahost – Edgar Spacey Jun 25 '21 at 16:56
  • In azure you need to configure your ms sql server to be accessible remotely first. – Shadow Jun 25 '21 at 16:59
  • Shadow - I am able to connect the node.js and sql server on localhost but not when i take it to production. Logs are giving a connection error so its probably the db vars thats the issue I need to fix – Edgar Spacey Jun 25 '21 at 17:00
  • Shadow : In azure you need to configure your ms sql server to be accessible remotely first.- Thats the issue I don't know how to do that cause I don't even where to they got the db i have no info on that i am just working a project as an intern. – Edgar Spacey Jun 25 '21 at 17:02
  • Check out [https://connectionstrings.com](https://connectionstrings.com) - they show tons of different ways of specifying connection strings, and explain what these parts in the connection strings mean and how they work – marc_s Jun 25 '21 at 17:02

0 Answers0