Establishing a session

A 1010data Insights Platform session is an instance of a particular user ID logged into the platform within a certain environment. A session is comprised of a dedicated set of resources that can serve a single request at a time.

A single platform session may have multiple Session objects attached to it. When a user logs into the platform, if no session is active, a new one is created. If a session is currently active for that user, the login type determines if that session is possessed, ended and a new one is started, or fails to connect. Currently, each user ID can only have one platform session associated with it. For more information about login type, see Login Types.

In the example, the Session object is created in the Main method. The new Session object testSession takes four parameters:
  • a URI (gateway)
  • a valid Insights Platform user name (user)
  • that user's password (pwd)
  • the login type, which is LoginType.POSSESS in this example

If you are connecting via a proxy server, your gateway string contains your proxy server address and any credentials. For more information, see Connecting via proxy.

import com.tentendata.javasdk1010v2.*;

public class DocumentationExample {
    public static void printRows(Row r) {
        System.out.println(r);
    }
    
    public static void main(String[] args) {
        String gateway = "https://www2.1010data.com/cgi-bin/gw.k";
        String user = "[USER_NAME]";
        String pwd = "[USER_PASSWORD]";  
        Session testSession = new Session(gateway, user, pwd,
                                          LoginType.POSSESS);
    }
}
Note: [USER_NAME] and [USER_PASSWORD] are placeholders for valid Insights Platform user name and password.