Package org.europa.together.application
Class JdbcActions
java.lang.Object
org.europa.together.application.JdbcActions
- All Implemented Interfaces:
DatabaseActions
Implementation of Database JDBC Actions.
-
Field Summary
Fields inherited from interface org.europa.together.business.DatabaseActions
FEATURE_ID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Establish an JDBC connection.int
countResultSets
(ResultSet results) Count the size of a ResultSet.executeQuery
(String sql) Execute a plain SQL query and get the ResultSet.boolean
executeSqlFromClasspath
(String sqlFile) Load an SQL file from the classpath and execute the script.Return a object with all JDBC connection meta date.
-
Constructor Details
-
JdbcActions
public JdbcActions()Constructor.
-
-
Method Details
-
connect
Description copied from interface:DatabaseActions
Establish an JDBC connection. If the propertyFile parameter is empty, then the method load by default the configuration from the classpath. The path to the external property file have to be relative to the execution path.- Specified by:
connect
in interfaceDatabaseActions
- Parameters:
propertyFile
- as String- Returns:
- true on success
-
executeSqlFromClasspath
Description copied from interface:DatabaseActions
Load an SQL file from the classpath and execute the script. Attention: This function should be used to populate a database and so on. It is not designed to handle multiple ResultSets by using SELECT. If multiple SELECT statements appears in an SQL file, then only the ResultSet of the last SELECT statement will be available.
Internal call this function for each single SQL statement the executeQuery() method.- Specified by:
executeSqlFromClasspath
in interfaceDatabaseActions
- Parameters:
sqlFile
- as String- Returns:
- true on success
-
executeQuery
Description copied from interface:DatabaseActions
Execute a plain SQL query and get the ResultSet. If there exist multiple SELECT statements, then the ResultSet contains only the rusultSet of the last SELECT statement.- Specified by:
executeQuery
in interfaceDatabaseActions
- Parameters:
sql
- as String- Returns:
- result as ResultSet
- Throws:
SQLException
-
countResultSets
Description copied from interface:DatabaseActions
Count the size of a ResultSet.- Specified by:
countResultSets
in interfaceDatabaseActions
- Parameters:
results
- as ResultSet- Returns:
- count the results
- Throws:
SQLException
-
getJdbcMetaData
Description copied from interface:DatabaseActions
Return a object with all JDBC connection meta date.- Specified by:
getJdbcMetaData
in interfaceDatabaseActions
- Returns:
- JdbcConnection as Object
- Throws:
SQLException
-