[DB-SIG] Simple? ODBC connection issue
Chris Clark
Chris.Clark at ingres.com
Fri Oct 17 03:21:48 CEST 2008
On 10/16/2008 5:55 PM, Peter Machell wrote:
> ...If I hard code the password, the connection works fine:
>
> cnxn = pyodbc.connect("DSN=test;UID=test;PWD=test")
>
> However substituting a variable fails:
>
> passwd='test'
> connectstring='pyodbc.connect("DSN=test;UID=test;PWD='+passwd+'")'
> cnxn = connectstring
> ...
Try printing the string to screen first :-)
You have single quotes embedded in the variables based so the variable
is never in place. Use % markers instead and make your life easier :-)
More information about the DB-SIG
mailing list