Page 1 of 1

Cannot connect to server on host

Posted: Mon 29 May 2017 23:57
by charlesherndon
I'm new here and trying to figure out how to write an application, send it to another user on a different computer, and have them be able to connect to my database.

I set up a MySQL connection for the app in Delphi XE2 using MyDac components.
A database is created. I use Localhost, setup a connection. all works great on my computer.

I deploy the app and database to another user's computer and they cannot connect.
I know I sound stupid here, but I really need a strategy to make this work.

Re: Cannot connect to server on host

Posted: Tue 30 May 2017 13:05
by ViktorV
If MySQL server is on the same machine where the application is run, the TMyConnection.Server property should be assigned the "localhost" or "127.0.0.1" value, otherwise, TMyConnection.Server should contain the address of the remote MySQL server. Therefore, to solve the issue, please set the TMyConnection.Server (IP address of MySQL server) and TMyConnection.Port (MySQL server port - by default - 3306) properties to the correct values.
Also, you can enable a dialogue window displaying of connection to MySQL server by setting the TMyConnection.LoginPrompt property to True and adding MyDACVcl module to the uses clause of your module.

Re: Cannot connect to server on host

Posted: Tue 30 May 2017 16:49
by charlesherndon
Thanks for the quick reply.
I do not know whether the machine on which the application is deployed will have MySQL server installed. It is not installed on the test machine that I deployed the application to.

The documentation says: "MyDAC-based DB applications are easy to deploy, do not require installation of other data provider layers". Is it necessary to also deploy and install MYSQL?
I hoped to provide the application and the database and have it work as it did on the development machine.

It isn't clear to me what the Tmyconnection.server setting should be (Localhost? 127.0.0.1?). I guess the TMyconnection.Port should be left to the default (3306).
If the dialog is opened, I doubt the user will know what to enter. (I don't know what to enter)

Is it possible to deploy an application and simply have it work?
TIA

Re: Cannot connect to server on host

Posted: Wed 31 May 2017 10:42
by ViktorV
MyDAC is developed for working with MySQL server which should be installed and configured in advance. The phrase at our site means that there is no need to install client libraries.
As we have already written, the TMyConnection.Server property should contain the address of MySQL server and TMyConnection.Port - MySQL server port. You can find more detailed information in MYDAC help: https://www.devart.com/mydac/docs/Devar ... embers.htm
If you do not need a remote server to solve the issue, you can use MySQL Embedded Server. You can find more information about work with MySQL Embedded Server here: https://www.devart.com/mydac/docs/?usin ... server.htm Note, MyDAC doesn't deploy any MySQL Embedded server library. To work with the Embedded server you should copy needed libmysqld.dll and the "Share" directory from the MySQL server directory to the directory with your application. This library is different for 32-bit and 64-bit application and it is supplied with MySQL server.

Re: Cannot connect to server on host

Posted: Wed 31 May 2017 18:34
by charlesherndon
Thanks for the reply
It sounds like using MySQL Embedded Server would do what we need.

The documentation refers to a demo of using embedding. I see "Embedded" in the general demo program list with a description. It says that Embedded is a separate demo program, but I cannot find it.
Does the installation put it somewhere else? Is there a way to see it?

Re: Cannot connect to server on host

Posted: Wed 31 May 2017 18:55
by charlesherndon
Found Embedded demo. Sorry.

Re: Cannot connect to server on host

Posted: Wed 31 May 2017 19:54
by charlesherndon
This is a slog
I'm trying to get the Embedded demo to connect.
Where should I get libmysqld.dll and where should I put it?

Do both the 32 and 64 bit dll's have the same name? Do we need separate paths to each and use compiler conditions to decide which to use?

Re: Cannot connect to server on host

Posted: Thu 01 Jun 2017 09:08
by ViktorV
The libmysqld.dll and share\english\errmsg.sys files are distributed with MySQL server distribution of the corresponding bitness.
Both 32-bit and 64-bit client libraries of the MySQL Embedded Server library are called the same - libmysqld.dll and each of them is distributed with the distribution of the corresponding bitness. It is enough to place libmysqld.dll in the same directory of the used file. You should place your application compiled for 32 and 64 bit with the corresponding files in different folders.

Re: Cannot connect to server on host

Posted: Thu 01 Jun 2017 16:14
by charlesherndon
On this machine, there is a MYSQL folder in both Program files and in Program Files (86).
There is no libmysqld.dll in either. There are libmysql.dll's (without the D)

Re: Cannot connect to server on host

Posted: Thu 01 Jun 2017 21:13
by charlesherndon
I got the MySQL zip files and took the 32 and 64 bit libmysqld.dll files from them.
I put the appropriate limysqld.dll in the same folder as the Embedded demo. When I try to connect at design time, in the TMyembconnection, I get the admonition to put the libmysql.dll in the folder with the application (Exactly where it is).
When I run the program, it connects (apparently from the libmysqld.dll, does TMyembconnection only connect that way?

My own little test program uses TMyConnection, rather than TMyEmbConnection. I can't get TMyconnection to connect at all with Embedded set to true. Same error about putting libmysql.dll in the program folder (where it is)

I don't understand the difference between TMyembconnection and TMybconnection.

Re: Cannot connect to server on host

Posted: Fri 02 Jun 2017 12:05
by ViktorV
In your case, you'd better use TMyEmbConnection instead of TMyConnection. The TMyEmbConnection component is used to establish a connection to MySQL Embedded server and provide its enhanced support.
To use the TMyConnection component when working with MySQL Embedded, you should set the TMyConnection.Options.Embedded property to True and TMyConnection.Server property to an empty string.

Re: Cannot connect to server on host

Posted: Sun 04 Jun 2017 22:51
by charlesherndon
Ok. I appreciate your help.
Maybe we should change strategy.
In the first step, we need to provide eleven databases with quite a bit of data in them. Currently these tables are in a MSSQL database "NeptuneConnection"
A few computers will be accessing these data tables located on a central server.
Can we install the MSSQL server on the Central server ? and install the application exe's on the networked machines?

Can the users configure the MSSQL on the central server so the application exe's can see the "neptuneConnection" data?

Re: Cannot connect to server on host

Posted: Tue 06 Jun 2017 09:35
by ViktorV
Questions about installing and configuring DBMS are not related to DAC components functionality. Please address this question to your system administrator / provider or refer to the documentation of the DBMS that you want to use.
When using DAC components to access the server database, it does not matter where exactly this database is located.