[DB-SIG] connect to db2

Bob Kline bkline@rksystems.com
Tue, 10 Sep 2002 17:21:15 -0400 (EDT)


On Tue, 10 Sep 2002, DJ Webre wrote:

> I can connect to my db2 table using:
>
>         self.conn = odbc.odbc('SQLPROD/d6407/password')
>
> but I can not connect using:
>
>
>         con_str =
> "'"+self.box_1.GetValue()+'/'+self.box_3.GetValue()+'/'+self.box_4.GetValue()+"'"
>         print con_str
>         try:
>             #self.conn = odbc.odbc('SQLPROD/d6407/password')
>
>             self.conn = odbc.odbc(con_str)
>
>
> I get the following error:
>
> Traceback (most recent call last):
>   File "D:\Documents and Settings\djwebre\My Documents\My
> Data\Python\mysql\c1.py", line 244, in OnBtnConnect
>     self.conn = odbc.odbc(con_str)
> dbi.operation-error: [Microsoft][ODBC Driver Manager] Data source name
> not found and no default driver specified in LOGIN
>
>
> Any suggestions are appreciated.

Drop the leading and closing single quotes.  The driver doesn't want
them.

In other words:

    con_str = "%s/%s/%s" % (self.box_1.GetValue(),
                            self.box_3.GetValue(),
                            self.box_4.GetValue())
    try:
        self.conn = odbc.odbc(con_str)

-- 
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com