public class ConnectionFactory extends Object
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes and releases all registered connections and connection pool
|
Connection |
getConnection() |
static ConnectionFactory |
getInstance() |
int |
getMaxConnections() |
String |
getPassword() |
DbProperties |
getProperties() |
String |
getServer() |
String |
getUser() |
static void |
initialize(String server,
String user,
String password)
Initialize the ConnectionFactory
|
protected static DbProperties |
propertiesFor(String server) |
void |
setMaxConnections(int max)
Mainly for Junit
|
String |
toString() |
protected static DbProperties propertiesFor(String server) throws UnsupportedOperationException
server
- the connection url of the databaseUnsupportedOperationException
- if the requested database
is not supportedpublic static void initialize(String server, String user, String password) throws SQLException, UnsupportedOperationException
UnsupportedOperationException
- if the requested database
is not supportedSQLException
- if a error occurs while connecting to the
databasepublic static ConnectionFactory getInstance()
public Connection getConnection() throws SQLException
SQLException
- if the ConnectionPool is not initialized or
if an error occurs while accessing the
databasepublic void setMaxConnections(int max)
max
- public void close()
public int getMaxConnections()
public String getServer()
public String getUser()
public String getPassword()
public DbProperties getProperties()
Copyright © 2009–2020 Waarp. All rights reserved.