Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TSQLConnection ignoring HostName?

106 views
Skip to first unread message

Ryan Eibling

unread,
Oct 4, 2005, 1:59:37 PM10/4/05
to
I've been searching for help on this and can't find anything, I
apologize if I'm missing something obvious - first time using dbexpress
(I've been using a custom wrapper around a mysql header translation for
years).

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

paladin

unread,
Oct 4, 2005, 3:49:30 PM10/4/05
to

welcome to some of the worst error reporting on the planet
but I digress...

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


Ryan Eibling

unread,
Oct 4, 2005, 4:11:06 PM10/4/05
to

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.

paladin

unread,
Oct 4, 2005, 5:23:42 PM10/4/05
to
> 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.

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


Cash Keith

unread,
Feb 21, 2006, 3:27:53 PM2/21/06
to

Did Paladin's suggestion work for you?
Thanks,
Cash

0 new messages