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?
auto login to remote database
Re: auto login to remote database
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.
Re: auto login to remote database
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.
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.
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
.....
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.
Re: auto login to remote database
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.
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.
Re: auto login to remote database
Sorry, I had the Server URL wrong in the MyConnection but right in the MyConnectDialog.
Re: auto login to remote database
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.
Feel free to contact us if you have any further questions about our products.