From c929e70e107caa75dc6988dddb59b57b2f4eeff8 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 6 Dec 2011 12:25:36 -0500 Subject: [PATCH] update pyodbc/SQL server connection strings, [ticket:2217] --- lib/sqlalchemy/dialects/mssql/pyodbc.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py index 529cdac509..b3572b5749 100644 --- a/lib/sqlalchemy/dialects/mssql/pyodbc.py +++ b/lib/sqlalchemy/dialects/mssql/pyodbc.py @@ -35,27 +35,31 @@ Examples of pyodbc connection string URLs: dsn=mydsn;UID=user;PWD=pass;LANGUAGE=us_english -* ``mssql+pyodbc://user:pass@host/db`` - connects using a connection string - dynamically created that would appear like:: +* ``mssql+pyodbc://user:pass@host/db`` - connects using a connection + that would appear like:: DRIVER={SQL Server};Server=host;Database=db;UID=user;PWD=pass * ``mssql+pyodbc://user:pass@host:123/db`` - connects using a connection - string that is dynamically created, which also includes the port - information using the comma syntax. If your connection string - requires the port information to be passed as a ``port`` keyword - see the next example. This will create the following connection - string:: + string which includes the port + information using the comma syntax. This will create the following + connection string:: DRIVER={SQL Server};Server=host,123;Database=db;UID=user;PWD=pass * ``mssql+pyodbc://user:pass@host/db?port=123`` - connects using a connection - string that is dynamically created that includes the port + string that includes the port information as a separate ``port`` keyword. This will create the following connection string:: DRIVER={SQL Server};Server=host;Database=db;UID=user;PWD=pass;port=123 +* ``mssql+pyodbc://user:pass@host/db?driver=MyDriver`` - connects using a connection + string that includes a custom + ODBC driver name. This will create the following connection string:: + + DRIVER={MyDriver};Server=host;Database=db;UID=user;PWD=pass + If you require a connection string that is outside the options presented above, use the ``odbc_connect`` keyword to pass in a urlencoded connection string. What gets passed in will be urldecoded -- 2.47.2