Java Utililty Methods SQL Stored Procedure

List of utility methods to do SQL Stored Procedure

Description

The list of methods to do SQL Stored Procedure are organized into topic(s).

Method

voidexecuteProcedure(Connection session, String sql)
execute Procedure
try (PreparedStatement dbStat = session.prepareCall(sql)) {
    dbStat.execute();
voidexecuteSqlScript(Connection conn, InputStream inputFile)
execute Sql Script
String delimiter = ";";
Scanner scanner;
scanner = new Scanner(inputFile).useDelimiter(delimiter);
Statement currentStatement = null;
while (scanner.hasNext()) {
    String rawStatement = scanner.next() + delimiter;
    try {
        currentStatement = conn.createStatement();
...
voidexecuteSqlScript(Connection connection, URL scriptUrl)
Executes SQL script.
for (String sqlStatement : readSqlStatements(scriptUrl)) {
    if (!sqlStatement.trim().isEmpty()) {
        connection.prepareStatement(sqlStatement).executeUpdate();
voidcreateTestProcedure()
create Test Procedure
java.sql.Connection jdbcConn = openJDBCConnection();
String str = "";
java.sql.Statement jdbcStmt = jdbcConn.createStatement();
for (int i = 0; i < DATA_TYPES.length; i++) {
    str = "drop procedure" + PROCEDURE_BASE_NAME + i;
    try {
        jdbcStmt.execute(str);
    } catch (Exception e) {
...