auto login to remote database

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dwilbourn
Posts: 6
Joined: Thu 01 Feb 2018 16:21

auto login to remote database

Post by dwilbourn » Thu 01 Feb 2018 16:28

I have been developing a database using MySQL as a localhost, all works fine there. I start the application and the connection is made to the database with no action on my part. I have now transferred the database to a remote server for further development and the auto connection no longer works. It does work if I set LoginPrompt to true. All the parameters are set in the component, I just have to wait for the login dialog to open and press OK.

Why do I have to do this? Is there a way to make the auto login work for remote databases as it does for localhost?

ViktorV
Devart Team
Posts: 2387
Joined: Wed 30 Jul 2014 07:16

Re: auto login to remote database

Post by ViktorV » Fri 02 Feb 2018 12:12

Please write in more detail about your question: what do you mean by "auto connection" and how do you organize it, whether you get any error, etc., and even better, if it does not complicate you, to better understand the question and an early reply to it, please send a small sample to demonstrate the issue to us via form e-support: https://www.devart.com/company/contactform.html.

dwilbourn
Posts: 6
Joined: Thu 01 Feb 2018 16:21

Re: auto login to remote database

Post by dwilbourn » Fri 02 Feb 2018 23:08

Sorry if that was not clear enough.
I started by connecting to a MySQL server installed on the same PC as I am developing my application, so localhost. The MyConnection has all properties (UserID, Password, Database, etc.) preset and LoginPrompt is false. When I start the app the connection is made and goes straight into querys etc.

Code: Select all

    
procedure TfrmMain.FormShow(Sender: TObject);
  MyConnection1.Connect;
  if myconnection1.Connected then
    begin
    .....
When I changed the connection properties to point to the same database on a remote server, the app hangs at the 'if MyConnection1.Connected then' statement with a 'sql wait' cursor. There are no error messages, it just goes into an eternal wait state.
But if I set LoginPrompt true, the login dialog appears with all the fields filled in, all I have to do is press 'Connect' and the connection is instantly made.
I hope that helps, I don't think a sample app would be much use, what you see above, plus the default MyConnection component, is basically it.

ViktorV
Devart Team
Posts: 2387
Joined: Wed 30 Jul 2014 07:16

Re: auto login to remote database

Post by ViktorV » Mon 05 Feb 2018 15:49

To solve your issue, please try to set the TMyConnection.Options.KeepDesignConnected property to False using Object Inspector.
If this does not solve the problem, please send a small sample to demonstrate the issue to us via form e-support: https://www.devart.com/company/contactform.html.

dwilbourn
Posts: 6
Joined: Thu 01 Feb 2018 16:21

Re: auto login to remote database

Post by dwilbourn » Tue 06 Feb 2018 17:31

Sorry, I had the Server URL wrong in the MyConnection but right in the MyConnectDialog.

ViktorV
Devart Team
Posts: 2387
Joined: Wed 30 Jul 2014 07:16

Re: auto login to remote database

Post by ViktorV » Wed 07 Feb 2018 09:17

It is good to see that the problem has been solved.
Feel free to contact us if you have any further questions about our products.

Post Reply