Mosaiq SQL Error

Hi there,

We’ve encountered this error attached . Please help.

Thank you.

Lip Teck

were you able to connect before?
with the same version of pymedphys?
the one thing that can probably be ruled out is “wrong credentials” because that is supposed to provide a different error.
Does a dnslookup of MOSAIQSQL return an appropriate IP address (to the MOSAIQ SQL Server)?

Hi Stuart

We are using version 0.37.1. It was working before tech refresh with SQL 2008. We are now using SQL 2019.

The nslookup to the host name gives a correct ip address with 2 second timed out. In the config csv file , both hostname and ip address gives same results.

Any suggestions? Thank you.

Lip Teck

let’s step back a bit.
How about confirming the ability to connect:
The example from Microsoft shows:
import pymssql
conn = pymssql.connect(server=‘’, user=‘yourusername@yourserver’, password=‘yourpassword’, database=‘AdventureWorks’)

so… substitute accordingly (start python from the command line), and see if you get a connection or not.
That way we separate pymedphys code from the pymssql code, and from the content of the parameters to pymssql.connect(…).

Is it possible that your SQL Server got hosted on a different IP address?

Hi Stuart

We deleted the user and recreated it as db_reader with login to database permission. It’s now working.

The db_reader no longer valid as we moved from old SQL 2008 to SQL 2019.

Thank you!

Lip Teck