pyodbc connect string
Larry Martell
larry.martell at gmail.com
Tue Apr 29 20:57:32 EDT 2014
I am having a problem building a connect string for pyodbc. It works
when everything is hard coded, but if I build the connect string it
fails.
This works:
pyodbc.connect('DRIVER=FreeTDS;' 'SERVER=xx.xx.xx.xx;' 'PORT=1433;'
'DATABASE=blah;' 'UID=foo;' 'PWD=bar;')
But this does not:
pyodbc.connect(conn_str)
Where conn_str is:
'DRIVER=FreeTDS;' 'SERVER=xx.xx.xx.xx;' 'PORT=1433;' 'DATABASE=blah;'
'UID=foo;' 'PWD=bar;'
conn_str is constructed with:
conn_str = "'DRIVER=%s;' 'SERVER=%s;' 'PORT=%s;' 'DATABASE=%s;'
'UID=%s;' 'PWD=%s;'" \
% (RECIPE_DB['DRIVER'], RECIPE_DB['SERVER'],
RECIPE_DB['PORT'], RECIPE_DB['DATABASE'],
RECIPE_DB['USER'], RECIPE_DB['PASSWORD'])
Anyone have any ideas as to why this doesn't work.
More information about the Python-list
mailing list