tediousjs / tedious

Node TDS module for connecting to SQL Server databases.
http://tediousjs.github.io/tedious/
MIT License
1.57k stars 436 forks source link

socketPath to Google Cloud Platform MS SQL Server database #1376

Open danielhorwitz opened 2 years ago

danielhorwitz commented 2 years ago

I'm trying to connect to a MS SQL Server database residing on the Google Cloud Platform. The application is running as a service on a Google node, so it does not have a static IP address. To connect through the firewall, I need to provide the socket path specified by the database setup in Google Cloud Platform. How do I configure the socket path for the tedious module?

danielhorwitz commented 2 years ago

An example socket path is the following: /cloudsql/horwitz-tapp-app:us-central1:horwitz-tapp-msxdb

MichaelSun90 commented 2 years ago

Hi @danielhorwitz, I have not used Google Cloud Platform before. I think tedious does not directly work with a socket path, but we can double-check that with Arthur. Just did a brief search online, and find a video that could be related to this. It uses something called sqlproxy to make the server reachable from localhost IP. Not sure if this can help you on this. I will post the link here: Run Windows Server & SQL Server on Google Cloud.

Hi @arthurschreiber, do you know anything about Google Cloud Platform and whether tedious support a connection using socket path?

danielhorwitz commented 2 years ago

Hi @MichaelSun90. That was a good solution for using Kubernetes. It is essentially the solution to use when running the application on a workstation, but communicating to the GCP database. It relies on starting the proxy on the workstation. Thanks for your suggestion. Sadly, I'm trying to run the application within a GCP app engine. In that case, we don't explicitly start the proxy, but have to include the socket path in the tedious connection configuration options.