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();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)
CreatesSession
by given URL.Session
getSession(java.lang.String url)
CreatesSession
by given URL.Session
getSession(java.util.Properties properties)
Creates aSession
using the information contained in the given properties.protected ConnectionUrl
parseUrl(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
ConnectionUrl
instance containing the URL components.
-
getSession
CreatesSession
by given URL.- Parameters:
connUrl
- the sessionConnectionUrl
.- Returns:
- a
Session
instance.
-
getSession
CreatesSession
by given URL.- Parameters:
url
- the session URL.- Returns:
- a
Session
instance.
-
getSession
Creates aSession
using the information contained in the given properties.- Parameters:
properties
- theProperties
instance that contains the session components.- Returns:
- a
Session
instance.
-