File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -188,13 +188,20 @@ def _cursor(self):
188188 else :
189189 driver = 'FreeTDS'
190190
191+ # Microsoft driver names assumed here are:
192+ # * SQL Server
193+ # * SQL Native Client
194+ # * SQL Server Native Client 10.0/11.0
195+ # * ODBC Driver 11 for SQL Server
196+ ms_drivers = re .compile ('.*SQL (Server$|(Server )?Native Client)' )
197+
191198 if 'dsn' in options :
192199 cstr_parts .append ('DSN=%s' % options ['dsn' ])
193200 else :
194201 # Only append DRIVER if DATABASE_ODBC_DSN hasn't been set
195202 cstr_parts .append ('DRIVER={%s}' % driver )
196203
197- if os . name == 'nt' or driver == 'FreeTDS' and \
204+ if ms_drivers . match ( driver ) or driver == 'FreeTDS' and \
198205 options .get ('host_is_server' , False ):
199206 if port_str :
200207 host_str += ';PORT=%s' % port_str
@@ -205,7 +212,7 @@ def _cursor(self):
205212 if user_str :
206213 cstr_parts .append ('UID=%s;PWD=%s' % (user_str , passwd_str ))
207214 else :
208- if driver in ( 'SQL Server' , 'SQL Native Client' ):
215+ if ms_drivers . match ( driver ):
209216 cstr_parts .append ('Trusted_Connection=yes' )
210217 else :
211218 cstr_parts .append ('Integrated Security=SSPI' )
You can’t perform that action at this time.
0 commit comments