Stuck at pymssql.connect() in python

413 Views Asked by At

my python program just hang when it come to running the statement pymssql.connect(), without displaying or throwing any error im running the python program window server 2012

The program can run smoothly on a laptop with same python and library version

1

There are 1 best solutions below

0
Abdel On

Make sure that the connection details (server address, username, password, database name) you're using in pymssql.connect() are correct and match the ones you used on the laptop, if you're using environment variables or import them from a configuration file, print their values to make sure there are present before the .connect() statement.

Ensure that there are no firewall restrictions or network issues preventing the server from being accessed. Check if the server is reachable from the Windows Server 2012 machine using tools like ping or telnet.

A very last solution will be that, pymssql requires Microsoft SQL Server's ODBC driver, so ensure that the ODBC driver is correctly installed and configured on your Windows Server 2012 machine.

If the issue still persists, consider providing more specific information about the environment, your code, and any error messages you encounter. This will help in providing more targeted assistance.