public class DefaultConnectionProvider extends Object implements ConnectionProvider
Constructor and Description |
---|
DefaultConnectionProvider()
Creates a new DefaultConnectionProvider.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Tells the connection provider to destroy itself.
|
Connection |
getConnection()
Returns a database connection.
|
double |
getConnectionTimeout()
Returns the amount of time between connection recycles in days.
|
String |
getDriver()
Returns the JDBC driver classname used to make database connections.
|
int |
getMaxConnections()
Returns the maximum number of connections that the pool will use.
|
int |
getMinConnections()
Returns the minimum number of connections that the pool will use.
|
String |
getPassword()
Returns the password used to connect to the database.
|
String |
getServerURL()
Returns the JDBC connection URL used to make database connections.
|
Boolean |
getTestAfterUse()
Returns whether returned connections will be tested after being returned to
the pool.
|
Boolean |
getTestBeforeUse()
Returns whether returned connections will be tested before being handed over
to be used.
|
String |
getTestSQL()
Returns the SQL statement used to test if a connection is valid.
|
String |
getUsername()
Returns the username used to connect to the database.
|
boolean |
isMysqlUseUnicode() |
boolean |
isPooled()
Returns true if this connection provider provides connections out
of a connection pool.
|
void |
restart()
This method should be called whenever properties have been changed so
that the changes will take effect.
|
void |
setConnectionTimeout(double connectionTimeout)
Sets the amount of time between connection recycles in days.
|
void |
setDriver(String driver)
Sets the JDBC driver classname used to make database connections.
|
void |
setMaxConnections(int maxConnections)
Sets the maximum number of connections that the pool will use.
|
void |
setMinConnections(int minConnections)
Sets the minimum number of connections that the pool will use.
|
void |
setPassword(String password)
Sets the password used to connect to the database.
|
void |
setServerURL(String serverURL)
Sets the JDBC connection URL used to make database connections.
|
void |
setTestAfterUse(Boolean testAfterUse)
Sets whether connections will be tested after being returned to the pool.
|
void |
setTestBeforeUse(Boolean testBeforeUse)
Sets whether connections will be tested before being handed over to be used.
|
void |
setTestSQL(String testSQL)
Sets the SQL statement used to test if a connection is valid.
|
void |
setUsername(String username)
Sets the username used to connect to the database.
|
void |
start()
Starts the connection provider.
|
String |
toString() |
public DefaultConnectionProvider()
public boolean isPooled()
ConnectionProvider
isPooled
in interface ConnectionProvider
public Connection getConnection() throws SQLException
ConnectionProvider
getConnection
in interface ConnectionProvider
SQLException
- is an SQL error occured while retrieving the connection.public void start()
ConnectionProvider
start
in interface ConnectionProvider
public void restart()
ConnectionProvider
restart
in interface ConnectionProvider
public void destroy()
ConnectionProvider
destroy
in interface ConnectionProvider
public String getDriver()
public void setDriver(String driver)
driver
- the fully qualified JDBC driver name.public String getServerURL()
public void setServerURL(String serverURL)
serverURL
- the JDBC connection URL.public String getUsername()
public void setUsername(String username)
username
- the username used to connect to the database.public String getPassword()
public void setPassword(String password)
password
- the password used to connect to the database.public int getMinConnections()
public void setMinConnections(int minConnections)
minConnections
- the minimum number of connections in the pool.public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections
- the max possible number of connections in the pool.public double getConnectionTimeout()
public void setConnectionTimeout(double connectionTimeout)
connectionTimeout
- the amount of time in days between connection
recycles.public String getTestSQL()
public void setTestSQL(String testSQL)
testSQL
- the SQL statement that will be run to test a connection.public Boolean getTestBeforeUse()
public void setTestBeforeUse(Boolean testBeforeUse)
testBeforeUse
- True or false if connections are to be tested before use.public Boolean getTestAfterUse()
public void setTestAfterUse(Boolean testAfterUse)
testAfterUse
- True or false if connections are to be tested after use.public boolean isMysqlUseUnicode()
Copyright © 2003-2008 Jive Software.