pyodbc -> MS-SQL Server Named Instance ?

Adam Tauno Williams awilliam at whitemice.org
Tue Jul 2 09:41:00 EDT 2019


On Tue, 2019-07-02 at 07:36 +0200, Frank Millman wrote:
> On 2019-07-01 10:13 PM, Adam Tauno Williams wrote:
> > I am trying to connect to a Named Instance on an MS-SQL server
> > using pyODBC.
> This is what I use -
> 
>      conn = pyodbc.connect(
>          driver='sql server',
>          server=r'localhost\sqlexpress',
>          database=self.database,
>          user=self.user,
>          password=self.pwd,
>          trusted_connection=True)
> 
> SQL Server is running on the same host as my python program, so it
> may  be a simpler setup than yours.

What ODBC driver are you using?

I have - 

>>> db = pyodbc.connect(
...     driver='ODBC Driver 13 for SQL Server',
...     server=r'server.example.com\instancename',
...     database='dbname',
...     user='*********',
...     password='*******', )
Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 13
for SQL Server]Login timeout expired (0) (SQLDriverConnect)')


[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2
UsageCount=1

-- 
Executive Committee Chair
Michigan Association of Railroad Passengers
537 Shirley St NE Grand Rapids, MI 49503-1754 Phone: 616.581.8010
E-mail: awilliam at whitemice.org GPG#D95ED383 




More information about the Python-list mailing list