Login

In addition to specifying the user ID and password for connect when connecting to a DolphinDB server, you can also use the login method to log in a user.

Syntax

public void login(String userID, String password, boolean enableEncryption)

Parameters

  • userID: A string indicating the username.

  • password: A string indicating the password.

  • enableEncryption: Whether to enable public key encryption for login. If encryption is enabled, the encryption mode will use public key encryption.

Example

The following example demonstrates logging in with the userId as "admin" and password as "123456", with encryption enabled.

@Test
public void testLogin() throws IOException {
    DBConnection dbConnection = new DBConnection();
    dbConnection.connect("192.168.1.167", 18921);
    dbConnection.login("admin", "123456", true);
}

This example logs in the user "admin" and enables login encryption.