类 SessionFactory
- java.lang.Object
-
- com.mysql.cj.xdevapi.SessionFactory
-
public class SessionFactory extends Object
SessionFactory is used for creation of sessions.SessionFactory xFactory = new SessionFactory();
Sessionsession1 = xFactory.getSession("mysqlx://[user1[:pwd1]@]host1[:port1]/db");Sessionsession2 = xFactory.getSession("mysqlx://host2[:port2]/db?user=user2&password=pwd2");Sessionsession3 = xFactory.getSession("mysqlx+srv://[user1[:pwd1]@]service_name/db");
-
-
构造器概要
构造器 构造器 说明 SessionFactory()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected SessiongetSession(ConnectionUrl connUrl)CreatesSessionby given URL.SessiongetSession(String url)CreatesSessionby given URL.SessiongetSession(Properties properties)Creates aSessionusing the information contained in the given properties.protected ConnectionUrlparseUrl(String url)Parses the connection string URL.
-
-
-
方法详细资料
-
parseUrl
protected ConnectionUrl parseUrl(String url)
Parses the connection string URL.- 参数:
url- the connection string URL.- 返回:
- a
ConnectionUrlinstance containing the URL components.
-
getSession
protected Session getSession(ConnectionUrl connUrl)
CreatesSessionby given URL.- 参数:
connUrl- the sessionConnectionUrl.- 返回:
- a
Sessioninstance.
-
getSession
public Session getSession(String url)
CreatesSessionby given URL.- 参数:
url- the session URL.- 返回:
- a
Sessioninstance.
-
getSession
public Session getSession(Properties properties)
Creates aSessionusing the information contained in the given properties.- 参数:
properties- thePropertiesinstance that contains the session components.- 返回:
- a
Sessioninstance.
-
-