[Haskell-cafe] Re: a question about Database.HDBC.ODBC
Changying Li
lchangying at gmail.com
Wed Sep 17 22:00:37 EDT 2008
thanks for your reply.
I'm sure isql is ok for me:
[chylli at arch tapl-haskell] isql test
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> show processlist;
+---------------------+------+----------------------+----------------------+--------+------------+-----------+----------------------------------+
| Id | User | Host | db | Command| Time | State | Info |
+---------------------+------+----------------------+----------------------+--------+------------+-----------+----------------------------------+
| 1 | root | localhost | test | Query | 0 | | show processlist |
+---------------------+------+----------------------+----------------------+--------+------------+-----------+----------------------------------+
SQLRowCount returns 1
1 rows fetched
I'm not sure where is the problem.
another problem is, the isql is not read configuration in ~/.dbic
Mads Lindstrøm <mads_lindstroem at yahoo.dk> writes:
> 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
--
Thanks & Regards
Changying Li
More information about the Haskell-Cafe
mailing list