Trouble connecting to MSSQL part 2

In the Stardog Designer, I am trying to connect to Connect a resource, more specifically MS SQL but is failing.

Here is what I entered for the endpoint: jdbc:sqlserver://Bekhor:1433;databaseName=Sample Company;user=sa;password=mypassword

Here is the error I am getting. I looked at the TCP/IP but made sure its not blocked by firewall but I get the following errormessage:

Failed to create data source: 000012: The TCP/IP connection to the
host Bekhor, port 1433 has failed. Error: "M-Bekhor. Verify the
connection properties. Make sure that an instance of SQL Server is
running on the host and accepting TCP/IP connections at the port.
Make sure that TCP connections to the port are not blocked by a
firewall.".

Please let me know what I am doing wrong

Hi. Make sure you check the connectivity from the machine that's running Stardog. If you're using Stardog from the Stardog hosted cloud, it will not know about this machine name (Bekhor or M-Bekhor). You can try supplying the IP address instead, but that will only work if the machine is publicly accessible.

-Paul

Hello Paul

The is a Virtual Machine. Does the affect the connectivity?

The VM name is M-Bekhor, Stardog is running within the this VM that has the SQL server . They are not connected via the network.

The full SQL instance is M-Bekhor\SAGE100CON and they the specific database is ‘Sample Company’

Regards

As long as the VM knows that its name is M-Bekhor, then it should work. If Stardog and SQL Server are running on the same VM, you could try using localhost as the server name. You may need to quote the database name since it contains a space:
jdbc:sqlserver://localhost:1433;databaseName={Sample Company};user=sa;password=mypassword

Hello Paul

I don't know what I am doing wrong, I have connect with: jdbc:sqlserver://M-Bekhor:1433;databaseName="Sample Company";user=sa;password=mypassword

But I still get the same error. Please see attachment
StardogError _Trouble Connecting to MS SQL.xml (371.1 KB)


According to their doc, you should use curly braces to escape spaces, but based on the error message, it doesn't look like it's getting that far. Did you try using the IP address?

Hello Paul

I have tried both the ip address & the curly brackets to no avail!!

Hello Paul

I have now used another database & an IP address.
jdbc:sqlserver://172.25.39.148:1433;databaseName={SYE_Ltd};user=sa;password=mypassword

I am getting new error. Although i must say started getting this new error this morning before I made the changes

ERROR:vFailed to create data source: Something went wrong and we're not
sure what it is. Contact your system admin to review Stardog
Knowledge Graph logs for more details if the issue persists.

Where do I find these "Stardog
Knowledge Graph logs"

It's referring to stardog.log, which can be found in your $STARDOG_HOME folder.

-Paul

Hello Paul

I searched for the "STARDOG_HOME", I couldn't find it & to be honest I don't recall installing any Stardog files initially. I think I using the Stardog Cloud .. but I am stuck at this point. I don't know what to do now. The error persists! Who can assist?

Regards

The issue you're having with connecting to your MSSQL server from your Stardog Cloud endpoint as an external data source is that your MSSQL server is not publicly accessible.

The IP address you list in your message above (172.25.39.148) is a private IP address. See What Is a Private IP Address? for more details.

You will need to configure a route to your MSSQL server that is publicly accessible. If you want to lock down access to your MSSQL server (so that it's not exposed to everyone on the internet), you can configure your firewall so that only the means of egress used by Stardog Cloud is allowed to connect to your MSSQL server. We document this here.

I am not good at networking is this how I achieve that, will these tasks work?:

A). SQL Server database not publicly accessible through port 1433 - Stack Overflow

B) Also to whitelist the Stardog domain I should I do the following:

  1. Access the Hyper-V virtual machine:
  • Connect to the VM using Hyper-V Manager or remote desktop.
  1. Configure the Windows Firewall inside the VM:
  • Open Windows Defender Firewall with Advanced Security.
  • Create a new Inbound Rule:
    • Go to "Inbound Rules" and click "New Rule"
    • Choose "Custom" rule type
    • For "Program", select "All programs"
    • For "Protocol and Ports", choose the appropriate protocol (e.g. TCP) and ports your app uses
    • For "Scope", add 44.238.183.*** to the "Remote IP addresses" list
    • Choose "Allow the connection"
    • Apply the rule to appropriate network profile(s)
    • Name the rule (e.g. "Allow 44.238.183.***")
      ...............
      I will try those Tasks, Please let me know if I am missing anything from the above tasks.

In part A (the stackoverflow post), the SQLServer in question already has a public IP address. That user is trying to allow access from a remote client. So that does not apply to your use case.

How you accomplish part B will depend on your hosting environment; the needed steps will be different if you are running in a cloud (e.g., AWS, Azure, GCP) versus a private data center versus a home network.

To be honest, exposing any computing resource to the public internet should only be done by someone who knows how to evaluate the risks and how to do so safely.

A different approach you could try is to use a hosted RDBMS that provides public access. I haven't investigated SQLServer options, but I know there are some PostgreSQL SaaS options that offer a free tier.

Thank you Paul,

The SQL Database that I am connecting to is a SandBox & its virtual machine. I am worried about security at the moment. This just proof of concept. When I go Live then I will find ways to do it securely. The SQL Database I am connecting to is for a Legacy software that is mostly installed on-prime servers. It Less likely to be in the cloud. If I have to migrate it most likely to be Azure as I have worked with it before. Could kindly give me instructions on how to publish SQL database for both Azure as well as instruction for MS SQL on a local server or virtual machine.

The Legacy Software has a MS SQL backend & I don't see them using PostgreSQL.

Could kindly give me instructions on how to publish SQL database for both Azure as well as instruction for MS SQL on a local server or virtual machine.

Unfortunately, this is beyond the scope of my knowledge. I would be doing the same thing as you, namely using a search engine to find the necessary solution.

If you are working in a VPC in AWS, you could try installing Stardog via our AWS Marketplace AMI. The AMI comes with a built-in license that is intended for a non-production system (e.g., it does not support clustering).

If that does not work for you, I recommend that you contact our sales team, and they can assist you with getting a trial license, so that you can install a Stardog server in the same local network as your SQLServer.