[Haskell-cafe] a question about Database.HDBC.ODBC

Mads Lindstrøm mads_lindstroem at yahoo.dk
Wed Sep 17 15:17:38 EDT 2008


Hi,

Changying Li wrote:
> 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.

Are you sure it is a HDBC and not a ODBC-library problem? It seems that
you use unixODBC and can then try the command:

  isql test

which will connect though unixODBC without involving HDBC. If you still
have the same problems, then it must be unrelated to HDBC.

> 
> 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 !!!
> 
> 
> 

Greetings,

Mads Lindstrøm





More information about the Haskell-Cafe mailing list