gudeads
Programmer
- Mar 20, 2009
- 2
Hello everyone,
I have a problem connectin to a mysql database server and I have no idea where the problem is.
I am using Codegear Delphi 2007 and DBX4 Framework.
This is the code:
Debug.Add('Before Connection Factory');
ConnectionFactory := TDBXConnectionFactory.GetConnectionFactory;
Debug.Add('Before Properties Create');
ConnectionProps := TDBXProperties.Create();
Debug.Add('Before Properties fill');
ConnectionProps.Add(TDBXpropertyNames.ConnectionName, 'macaddr');
ConnectionProps.Add(TDBXpropertyNames.DriverName, 'MYSQL');
ConnectionProps.Add(TDBXpropertyNames.HostName, 'mysql.ccag');
ConnectionProps.Add(TDBXpropertyNames.Database, 'CCD1');
ConnectionProps.Add(TDBXpropertyNames.UserName, 'apache');
ConnectionProps.Add(TDBXpropertyNames.Password, 'apache');
Debug.Add('Before GetConnection');
Connection := ConnectionFactory.GetConnection(ConnectionProps);
On the GetConnection method I get an exception:
'Can't connect to MySQL server on 'localhost' (10061)'
Now I don't understand why the server in the exception is localhost when I set it in the DBXProperties under 'HostName'
Can anyone help me
Thank you in advance
Marco
I have a problem connectin to a mysql database server and I have no idea where the problem is.
I am using Codegear Delphi 2007 and DBX4 Framework.
This is the code:
Debug.Add('Before Connection Factory');
ConnectionFactory := TDBXConnectionFactory.GetConnectionFactory;
Debug.Add('Before Properties Create');
ConnectionProps := TDBXProperties.Create();
Debug.Add('Before Properties fill');
ConnectionProps.Add(TDBXpropertyNames.ConnectionName, 'macaddr');
ConnectionProps.Add(TDBXpropertyNames.DriverName, 'MYSQL');
ConnectionProps.Add(TDBXpropertyNames.HostName, 'mysql.ccag');
ConnectionProps.Add(TDBXpropertyNames.Database, 'CCD1');
ConnectionProps.Add(TDBXpropertyNames.UserName, 'apache');
ConnectionProps.Add(TDBXpropertyNames.Password, 'apache');
Debug.Add('Before GetConnection');
Connection := ConnectionFactory.GetConnection(ConnectionProps);
On the GetConnection method I get an exception:
'Can't connect to MySQL server on 'localhost' (10061)'
Now I don't understand why the server in the exception is localhost when I set it in the DBXProperties under 'HostName'
Can anyone help me
Thank you in advance
Marco