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!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.065 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'subject:string': 0.09; 'cc:addr:python-list': 0.11; '(assuming': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'work.': 0.31; "skip:' 10": 0.31; 'larry': 0.31; 'anyone': 0.31; 'probably': 0.32; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'does': 0.39; 'skip:p 20': 0.39; 'is.': 0.60; 'tell': 0.60; "you're": 0.61; '30,': 0.65; 'not:': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=CUh3PwX0S1H3XZC3qdhpVHKiGgHO0oRjV/W5+dSWZ+U=; b=bbHu7hkbkouF3wA3jeXxsEo2LV+oRRmlxHixaazuhx26QAjt0zU2T97HA/kXy615W+ NMAXZAHtG4OTCs48HGcynNU9dKTQBJL2jZDBSe9kK3Jsp0Q8GRPmhFxGRwpg5uZPnWEQ GA/Kykr7VyYv691FAea+jV8+yYW3ztu6kYaZNcFtuIG36O3T4IiMJhJCz2auzmRj7IVZ Jg8GFt8O6KVvri4IGlTxxMlUZ9DtTpj0QY6FYzZXW+B0CCeXkCLIAM82d0jWS9lxrqYj 7x9s2b8YzxwmzyecoeVhJRK/fhcbVB0e64oVmc+mque8fdu6rt7fMmXzzAnbhc9EUZ8q Tz6Q== MIME-Version: 1.0 X-Received: by 10.58.122.164 with SMTP id lt4mr1082201veb.2.1398820188072; Tue, 29 Apr 2014 18:09:48 -0700 (PDT) In-Reply-To: References: Date: Wed, 30 Apr 2014 11:09:48 +1000 Subject: Re: pyodbc connect string From: Chris Angelico Cc: "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: 1398820197 news.xs4all.nl 2891 [2001:888:2000:d::a6]:53867 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70751 On Wed, Apr 30, 2014 at 10:57 AM, Larry Martell 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