mxODBC and MySQL access to remote DB
Joachim Schmitz
perry at ac-copy.net
Tue Jul 6 14:37:57 EDT 1999
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 )
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.
>
> Note that I have a line stating the database in my odbc.ini
> file:
>
> [mysql]
> DRIVER = /usr/local/lib/libmyodbc.so
> SERVER = localhost
> DATABASE = test
>
> Also note that iODBC switched from using a file named 'iodbc.ini'
> to 'odbc.ini' recently.
At least the odbctool is working with the iodbc.ini file.
Gruß
Joachim Schmitz
WWW-Consultant
email: js at ac-copy.net
tel: +49-241-89491-0
fax: +49-241-89491-29
More information about the Python-list
mailing list