class DatabaseService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
p2jHomePath
Absolute path to the project's home directory
|
private org.h2.jdbcx.JdbcConnectionPool |
pool
Connection pool (using default size of 10 and timeout of 30 seconds)
|
private static DatabaseService |
singleton
Singleton instance of this class
|
Constructor and Description |
---|
DatabaseService()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) java.lang.String |
escapeLikeRValue(java.lang.String text)
Escape all percent and underscore symbols in the text that will be used as the r-value
of a SQL LIKE expression, since these characters have special meaning to the LIKE
processing.
|
(package private) static DatabaseService |
get()
Get the singleton instance of this class.
|
(package private) void |
initialize()
Initialize database services for all sessions to use.
|
(package private) java.sql.Connection |
openConnection()
Check out a connection from the connection pool.
|
static final java.lang.String p2jHomePath
private static final DatabaseService singleton
private final org.h2.jdbcx.JdbcConnectionPool pool
DatabaseService()
static DatabaseService get()
java.sql.Connection openConnection() throws java.sql.SQLException
java.sql.SQLException
- if there is an error retrieving, opening, or preparing the connection.java.lang.String escapeLikeRValue(java.lang.String text)
\
) is used as the escape character.text
- R-value text.void initialize()