Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70751
| References | <CACwCsY5VpHrO7-gpk88p+zPyX5VsVcZnv3q1u00F3DPJviaR3Q@mail.gmail.com> |
|---|---|
| Date | 2014-04-30 11:09 +1000 |
| Subject | Re: pyodbc connect string |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9598.1398820197.18130.python-list@python.org> (permalink) |
On Wed, Apr 30, 2014 at 10:57 AM, Larry Martell <larry.martell@gmail.com> wrote:
> 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)
>
> 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.
Start by printing out conn_str. That'll tell you if it's actually
coming out the way you think it is. I can see where the problem
probably is (assuming these are faithful copy/pastes), in the form of
an extra double quote; but actually print them out and see what you're
getting.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: pyodbc connect string Chris Angelico <rosuav@gmail.com> - 2014-04-30 11:09 +1000
csiph-web