Page 1 of 1
					
				MyConnection->Connected says its connected..... but server is switched off
				Posted: Thu  09 Feb 2006 14:56
				by Rocojo
				I've builded a .dll (C++ builder and MyDAC 40028) witch is acting as a communicationlayer between my software and the databaseserver.
I still have some strange issues:
MyConnection problem:
After a MyConnection is connected and i swith of the server..... the MyConnection component is still saying that it has connection (MyConnection->Connected() == true)..... ( thats impossible when the server is switched off)
Closing problem:
By closing the driver while it is connecting with a server i cannot stop the MyConnection. Is it possible to destroy the connect() action?
Please help (oh sorry for my bad english)
			 
			
					
				
				Posted: Thu  09 Feb 2006 15:32
				by Rocojo
				hmmm ok i found out that when i am going to use the connection the component is saying.... no way you have no connection...and then myconnectionconnected == false
good to know
			 
			
					
				
				Posted: Fri  10 Feb 2006 14:08
				by Ikar
				> the MyConnection component is still saying that it has connection 
>  >(MyConnection->Connected() == true).....
MyDAC components doesn't check connection to the server all the time. The connection is checked only if it's necessary to get from the server any information. But you can check the connection manually using MyConnection.Ping.
>Is it possible to destroy the connect() action?
What do you mean by destroying the connection action? What is the reason to do this?
			 
			
					
				
				Posted: Mon  20 Feb 2006 10:12
				by Rocojo
				In someway it takes quite a while to connect over a network with a mysql server. This is no problem because i made a thread within the connect action. But the problem is: when i want to close my program i have to wait for all the threads to be closed because i cannot stop the thread while the myconnection is trying to connect with the server. 
But i think this is a problem in Microsoft Windows because when i am browsing the network, windows hangs a few seconds to....
I thought maybe it is possible to destroy the myconnection component so it is not searching for the server anymore.
			 
			
					
				
				Posted: Mon  20 Feb 2006 21:44
				by GEswin
				I find that one of the great things is that connections are made very quickly.. Check your settings, also if your server is connected to internet and the DNS servers. When connecting, mysql resolves the name of connection to checkup the user/privileges. 
 I normally add the 
 to the MySQL config files (my.ini under windows, my.cnf under linux). Look at 
http://dev.mysql.com/doc/refman/5.1/en/dns.html for more details.
 
			 
			
					
				
				Posted: Fri  24 Feb 2006 13:06
				by Rocojo
				oh, ok thank you for your reply.
I will try the skip-name-resolve and check my settings.
			 
			
					
				
				Posted: Mon  27 Feb 2006 10:53
				by Rocojo
				It's working... connecting to the server is really fast! thank you very mutch.
I found another problem in my DLL.
When i want to close my application (which is using my dll) i got an error.
Is the following code correct? ( i know this is not the forum for these questions but nobody can answer it.... so i hope somebody can help me.)
#pragma argsused
BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
{
  return (true);
}
//---------------------------------------------------------------------------
std::auto_ptr ASBSQLForm(new TASBSQLForm1(NULL));
extern "C" _declspec(dllexport) AnsiString __stdcall ASBDD_Connection_Connect( void )
{
  ASBSQLForm->ASBDDInsertSelectConnectEvent = true;
  return ("true");
}