

Any keywords except autocommit, ansi, and timeout


The connection string can be passed as the string `str`, as a list of keywords, Refer to SQLDriverConnectĭocumentation or the documentation of your ODBC driver for details. Note the use of braces when a value contains spaces. To connect without requiring a DSN, specify the driver and connectionĭRIVER= SERVER=localhost DATABASE=testdb UID=user PWD=password **cnxn = nnect('DSN=DataSourceName UID=user PWD=password')** **The connection string will be passed to SQLDriverConnect, so a DSN connection Observation from the pyodbc API docs, apprently no way to do it without UID and PWD def connect(p_str, autocommit=False, ansi=False, timeout=0, **kwargs): # real signature unknown restored from _doc_Ĭonnect(str, autocommit=False, ansi=False, timeout=0, **kwargs) -> ConnectionĪccepts an ODBC connection string and returns a new Connection object. So if I use PID and PWD it works but if I put the PID and PWD in my DSN configuration (MYMSSQL) and remove these two attributes from conn_str then it doesn't work, below is the DSN configuration: what I am seeing is that I cannot connect to database unless I specify the username (PID) and password (PWD) in the connection string like this: conn_str = 'DSN=MYMSSQL UID=sa PWD=password' I am looking to establish a connection to MS SQL through a DSN using pyodbc.
