<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloConnection > TApolloConnection Methods > Connect |
Declaration
procedure Connect;
Description
Attempts to connect the client to the server at the location specified by the Host and Port properties. If the connection fails, the OnError event is fired. Otherwise, if an OnError event handler is not defined and the connection fails, an exception is raised that can be trapped by a try…except block.
This only connects to the server, but does not perform a user login. To log into the server, you would also need to set the User and Password properties and call the Login method. You will not be able to open any tables until also performing a call to Login.
Setting the Active property to True when the User and Password properties are set is the same as calling Connect followed by Login, and is the preferred technique for logging into the server.
Delphi Example
function TForm1.ConnectToServer( sHost: String ): Boolean;
begin
ApolloConnection1.Host := sHost;
Result := True;
try
ApolloConnection1.Connect;
ApolloConnection1.User := 'SYSDBA';
ApolloConnection1.Password := 'masterkey';
ApolloConnection1.Login;
except
ShowMessage( 'Connection failed!' );
end;
end;
See Also
LoginLogin, DisconnectDisconnect, ActiveTApolloConnection_Active, OnErrorOnError