类 SessionFactory


  • public class SessionFactory
    extends 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");
     
    • 构造器详细资料

      • SessionFactory

        public SessionFactory()
    • 方法详细资料

      • parseUrl

        protected ConnectionUrl parseUrl​(String url)
        Parses the connection string URL.
        参数:
        url - the connection string URL.
        返回:
        a ConnectionUrl instance containing the URL components.
      • getSession

        public Session getSession​(String url)
        Creates Session by given URL.
        参数:
        url - the session URL.
        返回:
        a Session instance.
      • getSession

        public Session getSession​(Properties properties)
        Creates a Session using the information contained in the given properties.
        参数:
        properties - the Properties instance that contains the session components.
        返回:
        a Session instance.