Package com.mysql.cj.xdevapi
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();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");
-
Constructor Summary
Constructors Constructor Description SessionFactory() -
Method Summary
Modifier and Type Method Description protected SessiongetSession(ConnectionUrl connUrl)CreatesSessionby given URL.SessiongetSession(java.lang.String url)CreatesSessionby given URL.SessiongetSession(java.util.Properties properties)Creates aSessionusing the information contained in the given properties.protected ConnectionUrlparseUrl(java.lang.String url)Parses the connection string URL.
-
Constructor Details
-
SessionFactory
public SessionFactory()
-
-
Method Details
-
parseUrl
Parses the connection string URL.- Parameters:
url- the connection string URL.- Returns:
- a
ConnectionUrlinstance containing the URL components.
-
getSession
CreatesSessionby given URL.- Parameters:
connUrl- the sessionConnectionUrl.- Returns:
- a
Sessioninstance.
-
getSession
CreatesSessionby given URL.- Parameters:
url- the session URL.- Returns:
- a
Sessioninstance.
-
getSession
Creates aSessionusing the information contained in the given properties.- Parameters:
properties- thePropertiesinstance that contains the session components.- Returns:
- a
Sessioninstance.
-