-1

I am running an application on linux machine and database mssql server. We use pypyodbc to connect to the db server with ip and port.

    conn_str = "DRIVER=FreeTDS;SERVER=192.168.0.1;PORT=1433;DATABASE=xxx;UID=sa;PWD=xxx;TDS_Version=8.0"
    pypyodbc.connect(conn_str)

But now I need to connect to db server with the windows authentication name like.

Database Instance Name: INST1
DB login: INST1\SQLEXPRESS

How can I add this into connection string.

I am getting error like this

pypyodbc.DatabaseError: (u'08001', u'[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source'

But with the ip I can connect.

Thanks

Karesh A
  • 1,731
  • 3
  • 22
  • 47

1 Answers1

0

In order to connect by instance name, the SQL Browser service must be running on the SQL Server machine. Once that condition is met, a connection string like

conn_str = r"DRIVER=FreeTDS;SERVER=192.168.1.122\SQLEXPRESS;DATABASE=myDb;UID=sa;PWD=whatever"

will work.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418