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 TypeMethodDescriptionbooleanEstablish an JDBC connection.intcountResultSets(ResultSet results) Count the size of a ResultSet.executeQuery(String sql) Execute a plain SQL query and get the ResultSet.booleanexecuteSqlFromClasspath(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:DatabaseActionsEstablish 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:
connectin interfaceDatabaseActions- Parameters:
propertyFile- as String- Returns:
- true on success
-
executeSqlFromClasspath
Description copied from interface:DatabaseActionsLoad 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:
executeSqlFromClasspathin interfaceDatabaseActions- Parameters:
sqlFile- as String- Returns:
- true on success
-
executeQuery
Description copied from interface:DatabaseActionsExecute 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:
executeQueryin interfaceDatabaseActions- Parameters:
sql- as String- Returns:
- result as ResultSet
- Throws:
SQLException- in case of error
-
countResultSets
Description copied from interface:DatabaseActionsCount the size of a ResultSet.- Specified by:
countResultSetsin interfaceDatabaseActions- Parameters:
results- as ResultSet- Returns:
- count the results
- Throws:
SQLException- in case of error
-
getJdbcMetaData
Description copied from interface:DatabaseActionsReturn a object with all JDBC connection meta date.- Specified by:
getJdbcMetaDatain interfaceDatabaseActions- Returns:
- JdbcConnection as Object
- Throws:
SQLException- in case of error
-