Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.076 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'string': 0.09; 'subject:string': 0.09; 'fails.': 0.16; 'to:name:python- list@python.org': 0.22; 'skip:p 30': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'work.': 0.31; "skip:' 10": 0.31; 'anyone': 0.31; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'not:': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=8KacDCDgJxdSOS9Phb8n8tR1LCFKCOVJODSXQ786TSs=; b=EA5GWXNbcMsZHEHjMyRFdahrteDViNYYe9d3Z6+ZbpQAuXvK/HVig1oUGzXtHc2FLL YL+sobXl/fKCjT5pZvj7dE1lTnzWrEd4aLi2N3kRkTET1EtfztVk4C6X/tkOkZXOJ4L3 mguQeRnWBjfXJlYpNtz/15HbKMfx3IPsW265v9U6+ld4C7nRB7tCu9Llb9hL7ov/v8Br xBpfZ/3Wc2wysGzj1mjomusTl7MA3p4JgybRzCVWVKDFPPwUhpBqGTolAGM+AIlzJAA0 PeWs44SvIXFbRGIgzo/qwy9Wl+g+fMaruu3GGebA4OIYH5eRB/IEKMsBzJGQYN4dbqcq Sgew== MIME-Version: 1.0 X-Received: by 10.180.89.1 with SMTP id bk1mr828430wib.35.1398819452165; Tue, 29 Apr 2014 17:57:32 -0700 (PDT) Date: Tue, 29 Apr 2014 18:57:32 -0600 Subject: pyodbc connect string From: Larry Martell To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398819454 news.xs4all.nl 2852 [2001:888:2000:d::a6]:49132 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70750 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.