mxODBC and MySQL access to remote DB

M.-A. Lemburg mal at lemburg.com
Tue Jul 6 17:08:12 EDT 1999


Joachim Schmitz wrote:
> 
> On Tue, 6 Jul 1999, M.-A. Lemburg wrote:
> 
> > >     ,DBtype="MySQL")
> > >   File "Form.py", line 45, in __init__
> > >     ,"pw="+self.pw)^M
> > > mxODBC.OperationalError: ('S1000', 1045, "[TCX][MyODBC]Access denied for
> > > user: 'user=perry at localhost' (Using password: YES)", 4237)
> >
> > This a problem with MySQL, not mxODBC. Please check the MySQL
> > logs for more detailed information about access failures.
> >
> 
> The problem was that mxODBC or better the ODBC-driver myodbc_mysql didn´t
> connect to the host "test.ac-copy.net" but to localhost. I finally found
> the solution in the connect.c module of the driver: (version
> iodbc-2.50.22a/myodbc-2.50.22 )

Ah, ok, that sounds reasonable.
 
> in  SQLConnect around line 183.
> 
> #ifndef _UNIX_
>   SQLGetPrivateProfileString(fix_str(dsn,szDSN,cbDSN),"server",
>                              "localhost", host, sizeof(host),"ODBC.INI");
>   SQLGetPrivateProfileString(dsn,"database",
>                              dsn, database, sizeof(database),"ODBC.INI");
>   SQLGetPrivateProfileString(dsn,"port",
>                              "0", port, sizeof(port),"ODBC.INI");
>   port_nr=(uint) atoi(port);
>   SQLGetPrivateProfileString(dsn,"flag",
>                              "0", flag, sizeof(flag),"ODBC.INI");
>   flag_nr=(ulong) atol(flag);
>   SQLGetPrivateProfileString(dsn,"stmt",
>                              "0", init_stmt,sizeof(init_stmt),"ODBC.INI");
> #else
>   strmov(database,szDSN);
>   {
>     char *cp;
>     strmov(host, (cp = getenv("MYSQL_HOST")) ? cp : "localhost");
>   }
>   flag_nr=0;
>   init_stmt[0]=0;
> #endif /* IS UNIX */
> 
> After setting the enviromentvariable MYSQL_HOST to test.ac-copy.net it
> worked.
> I´m not sure if this is the intended behavior, cause it´s nowhere
> documented.

Anyway, it shows Open Source at it's best ;-)

Cheers,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   178 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list