Bug #106
MySQL/UnixODBC requires explicit UID
| Status : | Feedback | Start : | 10/03/2008 | |
| Priority : | Low | Due date : | ||
| Assigned to : | - | % Done : | 0% |
|
| Category : | - | |||
| Target version : | - | |||
| Resolution : |
Description
HDBC Does not correctly connect with "DSN=mysql" given the following unixODBC setup. It connects as @localhost instead of localuser@localhost. To correctly connect, one needs to pass "DSN=mysql;UID=localuser;PWD=;". Other applications (e.g. Erlang) connect correctly with "DSN=mysql".
/etc/odbc.ini:
[mysql] Driver = MySQL Description = MySQL Driver USER = localuser PASSWORD = DATABASE = test OPTION = SOCKET = /var/lib/mysql/mysql.sock
Haskell code to test:
import Database.HDBC
import Database.HDBC.ODBC
main = do conn <- connectODBC "DSN=mysql"
[ [SqlString user] ] <- quickQuery' conn "SELECT CURRENT_USER();" []
putStrLn user
Running the above gives "@localhost", expected: "localuser@localhost".
Fedora 9, GHC 8.3, HDBC 1.1.5
History
10/03/2008 04:34 PM - John Goerzen
- Status changed from New to Feedback
I'm not convinced that this is a bug.
I also have no idea what you are suggesting the correct behavior is.
Where is Erlang divining its username from?
Where is the spec that says that it is doing the correct thing?
I am quite unconvinced that HDBC ought to be mucking with the DSN.
10/04/2008 05:16 AM - Anton Tayanovskyy
Erlang, isql and friends are getting the username from the DSN (odbc.ini). I just realized that when compiled, the Haskell program does this too! The problem happens only in interactive mode, and not all of the time (randomly).
Please close the ticket. I looked hard at the HDBC source, wrote equivalent C, and I don't think anything can be changed. And it's likely I'm the only one having this problem.
But I'm still morbidly curios why on earth runghc and compiled versions would give different behaviors here.