Cannot connect to DB - Exhausted all options

I have been using a multi set up for over a year now, all was working fine. I put in a new server and used as main POS, removed old server and one of the POS. SO now, instead of having 4 terminals (server, pos1, pos2, pos3) we now have 3 terminals (pos1 pos2(server), pos3)

After connecting it up, setting up and running we successfully had all 3 terminals talking to each other via the SQL DB on POS2.

The owner then moved the wifi router and since then we haven’t had anything. They have been running on 1 till for a couple days now. I haven’t been able to go in and sort it because I have my own business, but this morning I have gone in and I just cant work it out.

All 3 terminals are connected to a network and also a homegroup. They all connect to the internet which is being shared from POS1.

Opening file explorer you can see all 3 terminals, I can also connect to them all remotely.

I have gone through the troubleshooting post and all is fine, this troubleshoot is mainly for a single terminal, and so the 1 terminal can connect. The other 2 just refuse to connect.

All strings are correct in the database, I have checked… but also that they DID all work until the router was moved.

Can there be possibly ANY other reason as to why they just refuse to connect?

Matt

Staff member turned on firewall… fml

2 days of phonecalls… shoulda checked that first lol

I honestly think you should have the firewall on and just set a rule for the SQL server Port number and Message server port number to pass through, this way your not vulnerable if their system is online on the internet. This is like standard procedure when I do clients here.

2 Likes

I agree it is really simple to just add a provision in the firewall.

would it be just the server? im unsure how to do this

also what port is the server likely to be… i know what message server is

Port details are on the forum somewhere.
There was even a power shell script somewhere to do the ports.

a wut? (seriously, im not that clever)

@GreatShakesBar

If you are using Windows 10 as a server, staff might turn on firewall without knowing. Windows 10 prompts to turn on firewall by clicking a notification.This message is not clear that you are turning firewall on. There is no Yes/No/On/Off. Clicking notification turns on firewall.

If you decide to leave firewall off(which is fine if you have a router with firewall. Most routers offer firewall security), you need to disable firewall notifications. Otherwise this will happen again.

Hope it helps other people.

2 Likes

yep did that, it was a new server i just didnt disable notifications. It is done all all the other tills already just this one… which was the server… the most important lol

I allow the services and do not worry about the ports.

You can allow specific Applications access through the Firewall, or you can allow any App access through specific Ports. My preference is to allow Ports, while others prefer to allow Apps.

## fwrules.ps1 (Powershell Script)

This script makes allowances for Ports rather than Apps. The last 3 lines are what set up the (Incoming) Rules for opening ports. The rest of the script are support functions for the last 3 lines.

function getRule {
    param(
        [string] $name
    )
    $fw = Get-NetFirewallRule -DisplayName "$name" -ErrorAction:SilentlyContinue
    if ($fw) {
        return [bool]$true
    } else {
        return [bool]$false
    }
}
function setRule {
    param(
        [string] $name,
        [string] $port,
	[string] $protocol,
	[string] $profile
    )
    Set-NetFirewallRule -DisplayName "$name" -Action "Allow" -Direction "Inbound" -Enabled "True" -LocalPort "$port" -Profile "$profile" -Protocol "$protocol" -Verbose
}

function addRule {
    param(
        [string] $group,
        [string] $name,
        [string] $port,
	[string] $protocol,
	[string] $profile
    )

    $fw = getRule("$name")
    if ($fw) {
	Write-Host -ForegroundColor:Black -BackgroundColor:Magenta "`r`n*** Rule already exists, Modifying Rule: '$name' ..."
	setRule -name:"$name" -port:"$port" -profile:"$profile" -protocol:"$protocol" -Action "Allow" -Direction "Inbound" -Enabled "True"
    } else {
	Write-Host -ForegroundColor:Black -BackgroundColor:Green "`r`n****** Adding Rule: '$name' ..."
        New-NetFirewallRule -Group "$group" -DisplayName "$name" -Action "Allow" -Direction "Inbound" -Enabled "True" -LocalPort "$port" -Profile "$profile" -Protocol "$protocol"
    }

}

addRule -profile:"Private" -protocol:"TCP" -port:1433           -group:"Custom Rule - SambaPOS Multi-terminal" -name:"SambaPOS SQL Traffic"
addRule -profile:"Private" -protocol:"UDP" -port:1434           -group:"Custom Rule - SambaPOS Multi-terminal" -name:"SambaPOS SQL Browser Traffic"
addRule -profile:"Private" -protocol:"TCP" -port:9000           -group:"Custom Rule - SambaPOS Multi-terminal" -name:"SambaPOS Messaging Server"

  • edit the Powershell script (last 3 lines) to change ports if necessary
  • Open a CMD window as Administrator.
  • Navigate to the location of the Powershell Script ( fwrules.ps1).
  • Execute this line:
powershell -executionpolicy bypass -File fwrules.ps1

This topic has a summary of what needs to be done, as I walked through trouble-shooting connectivity issues:

2 Likes