Can't connect to MySQL server on 'localhost'

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
Gikas Markantonatos
Posts: 3
Joined: Mon 27 Feb 2006 06:23

Can't connect to MySQL server on 'localhost'

Post by Gikas Markantonatos » Mon 27 Feb 2006 06:29

Delphi 7, dbExpress V3, MySQL 5
I am trying to connect to a remote server. At Design time, I am able to do this, but at run time, I get the above error, even though I do not have a local server running

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 27 Feb 2006 10:13

Check if you create SQLConneñtion at runtime or change its parameter values.
If you try connecting without changing parameters and creating instance of the SQLConnection in runtime, please send us full description of SQLConnection you use. You can get it from *.dfm file.

Gikas Markantonatos
Posts: 3
Joined: Mon 27 Feb 2006 06:23

Invalid Username/Password SQL server error: Can't connect on 'localhost' (10061)

Post by Gikas Markantonatos » Mon 27 Feb 2006 15:23

Hi Anteus

I hope this answers your questions:

I am using a TSQLConnection, which connects fine at design time (by setting connected to true). I have tried leaving it open with the same settings (ie not changing the params at run time), and by changing the params at runtime, per the following code, but I still get the error message

conn.params.Clear;
conn.params.Add('hostname=xxxx');
conn.params.Add('database=yyyy');
conn.params.Add('user_name=root');
conn.params.Add('password=zzzz');
conn.open;

The component is set up as follows:
ConnectionName - MySQL (Core Lab)
DriverName - MySQL (Core Lab)
GetDriverFunc - getSQLDriverMySQL
KeepConnection - True
LibraryName - dbexpmda.dll
LoadParamsOnConnect - False
LoginPrompt - False
Name - Conn
Params - see above
VendorLib - libmysql.dll

Gikas Markantonatos
Posts: 3
Joined: Mon 27 Feb 2006 06:23

Can't connect - problem resolved

Post by Gikas Markantonatos » Tue 28 Feb 2006 02:42

3 steps

1) Remove dbExpMysql from the uses clauses in all units in the application
2) Remove connection.params.clear from the connection to the Tsqlconnection statement
3) Clean up any old libmysql.dll's that may be on the system

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 28 Feb 2006 13:11

We asked you to send us settings from *.dfm file to be sure that parameters have values you want. Please, try to set up parameters of the SQLConnection using object inspector, do NOT use double-click on its icon. If it won't help, open *.dfm file with text editor (Notepad, for example) and copy description of the connection from it. It looks like this:

Code: Select all

  object SQLConnection: TSQLConnection
    ConnectionName = 'MySQL (Core Lab)'
    ...
  end

Post Reply