I'm trying to make a connection at runtime to a remote mysql db (4.1.x).
Connection := TSQLConnection.Create(nil);
Connection.LoadParamsOnConnect := False;
Connection.DriverName := 'MYSQL';
Connection.GetDriverFunc := 'getSQLDriverMYSQL';
Connection.LibraryName := 'dbexpmysql.dll';
Connection.VendorLib := 'LIBMYSQL.dll';
...
with Connection.Params do
begin
Clear;
Append('HostName=' + host);
Append('Database=' + db);
Append('User_Name=' + user);
Append('Password=' + password);
end;
Connection.Open;
Those host, db, user, password variables are passed in and I've traced
into that function to make sure the right values are getting in there.
For some reason on the "Open" call I get an "Invalid Username/Password"
error that ends with "Can't connect to MySQL server on 'localhost'".
Well, I'm definitely not telling it to connect to localhost, I'm setting
the HostName param to a remote IP and it seems to be ignoring it. I've
tried to place breakpoints in the SqlExpr unit to see where my params
are being lost but it shows my breakpoints as invalid. Any suggestions?
Thanks,
Ryan
you don't mention what version of Delphi you have, but
your problem is almost certainly that it will NOT connect
to the 4.1 (or any higher) version of MySQL.
4.01x is as high as you can go with native Borland drivers
-paladin
Thanks for the information. Sorry, it's Delphi 2005 with Update 3 on
Windows XP (patched up to date). I was being pulled away for something
else as I was writing the post.
Regardless of whether the driver can make the connection, why would an
error message say "localhost" when I gave it another hostname? I'm
pretty sure there's something else going wrong there because I just
copied it to a Windows machine where a test db is running and it *could*
connect, meaning it was still ignoring my param and using localhost, but
then I got an "operation not supported" error after connection.
Do you know of a good dbexpress driver for higher versions of mysql?
Thanks again.
IMHO the error reporting in dbx/datasnap is often abysmal and misleading.
nevertheless:
I would not do a params clear. (if you double click on the SQLconnection
component, you'll see why) Once the connection component is instantiated,
just adjust the params you need, eg:
SQLConnection1.Params.Values['Hostname'] := 'some_server';
SQLConnection1.Params.Values['Database'] := 'some_db';
SQLConnection1.Params.Values['User_name']:= 'some_user';
SQLConnection1.Params.Values['Password'] := 'user_pwd';
> Do you know of a good dbexpress driver for higher versions of mysql?
no. like the good and faithful borland customer, I am waiting for
them to give me a 'roadmap' for MySQL support. (including waiting to see
specifications for dexter (D2006))
Cynics might liken waiting for Borland's support of MySQL to a
bastard son waiting for his inheritance. I see Borland's options as:
- release roadmap about when/what versions supported
my choice ----> - release source code to drivers
- drop MySQL support altogether (proxy to 3rd party)
cynic choice -> - do nothing
In any case, I'm sure one of the third party company guys will jump
into this thread to tout their wares.
good luck,
paladin
Did Paladin's suggestion work for you?
Thanks,
Cash