Class SessionFactory

java.lang.Object
com.mysql.cj.xdevapi.SessionFactory

public class SessionFactory
extends java.lang.Object
SessionFactory is used for creation of sessions.
 SessionFactory xFactory = new SessionFactory();
 
 Session session1 = xFactory.getSession("mysqlx://[user1[:pwd1]@]host1[:port1]/db");
 Session session2 = xFactory.getSession("mysqlx://host2[:port2]/db?user=user2&password=pwd2");
 Session session3 = xFactory.getSession("mysqlx+srv://[user1[:pwd1]@]service_name/db");
 
  • Constructor Summary

    Constructors 
    Constructor Description
    SessionFactory()  
  • Method Summary

    Modifier and Type Method Description
    protected Session getSession​(ConnectionUrl connUrl)
    Creates Session by given URL.
    Session getSession​(java.lang.String url)
    Creates Session by given URL.
    Session getSession​(java.util.Properties properties)
    Creates a Session using the information contained in the given properties.
    protected ConnectionUrl parseUrl​(java.lang.String url)
    Parses the connection string URL.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • parseUrl

      protected ConnectionUrl parseUrl​(java.lang.String url)
      Parses the connection string URL.
      Parameters:
      url - the connection string URL.
      Returns:
      a ConnectionUrl instance containing the URL components.
    • getSession

      protected Session getSession​(ConnectionUrl connUrl)
      Creates Session by given URL.
      Parameters:
      connUrl - the session ConnectionUrl.
      Returns:
      a Session instance.
    • getSession

      public Session getSession​(java.lang.String url)
      Creates Session by given URL.
      Parameters:
      url - the session URL.
      Returns:
      a Session instance.
    • getSession

      public Session getSession​(java.util.Properties properties)
      Creates a Session using the information contained in the given properties.
      Parameters:
      properties - the Properties instance that contains the session components.
      Returns:
      a Session instance.