[Haskell-cafe] a question about Database.HDBC.ODBC
Changying Li
lchangying at gmail.com
Wed Sep 17 11:58:37 EDT 2008
I want to use hdbc to connect my mysql test db. so I set up my
/etc/odbcinst.ini :
[MySQL]
Description = ODBC Driver for MySQL
Driver = /usr/lib/libmyodbc.so
Setup = /usr/lib/libodbcmyS.so
FileUsage = 1
and /etc/odbc.ini:
[test]
Description = MySQL database test
Driver = MySQL
Server = localhost
Database = test
Port = 3306
User = root
Socket = /tmp/mysql.sock
Option =
Stmt =
user chylli at localhost must use password to connect mysql. other users needn't.
I connect db like this:
Prelude Database.HDBC.ODBC Database.HDBC> handleSqlError (connectODBC "DSN=test")
*** Exception: user error (SQL error: SqlError {seState = "[\"HY000\"]", seNativeError = -1, seErrorMsg = "connectODBC/sqlDriverConnect: [\"1045: [unixODBC][MySQL][ODBC 3.51 Driver]Access denied for user 'chylli'@'localhost' (using password: NO)\"]"})
Prelude Database.HDBC.ODBC Database.HDBC> handleSqlError (connectODBC "DSN=test;UID=chylli")
Prelude Database.HDBC.ODBC Database.HDBC>
in another term:
mysql> show processlist;
+----+-------------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------------+-----------+------+---------+------+-------+------------------+
| 31 | chylli¶è | localhost | test | Sleep | 1483 | | NULL |
| 43 | root | localhost | test | Sleep | 116 | | NULL |
my question is:
1. why not HDBC.ODBC use configuration in /etc/odbc.ini ? if is use,
then connectODBC "DSN=test" should use root as user without password and
it should succeed.
2. when using UID=chylli, why the user in 'show processlist' is not
chylli but 'chylli¶è' ? if it use account 'chylli', that connection
should fail. but in fact it succeed !!!
--
Thanks & Regards
Changying Li
More information about the Haskell-Cafe
mailing list