Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70750
| Date | 2014-04-29 18:57 -0600 |
|---|---|
| Subject | pyodbc connect string |
| From | Larry Martell <larry.martell@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9597.1398819454.18130.python-list@python.org> (permalink) |
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
pyodbc connect string Larry Martell <larry.martell@gmail.com> - 2014-04-29 18:57 -0600
csiph-web