Java Utililty Methods SQL Execute

List of utility methods to do SQL Execute

Description

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

Method

voidexecuteStatement(Connection con, String sql)
Insert data into the database.
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
voidexecuteStatement(Connection conn, String command)
execute Statement
java.sql.Statement statement = conn.createStatement();
try {
    statement.executeUpdate(command);
} finally {
    statement.close();
voidexecuteStatement(final String databaseName, final String statement)
execute Statement
Connection c = null;
Statement stmt = null;
try {
    c = DriverManager.getConnection("jdbc:sqlite:" + databaseName + ".db");
    stmt = c.createStatement();
    stmt.executeUpdate(statement);
    stmt.close();
    c.close();
...
voidexecuteStatements(final Connection conn, final List statements)
execute Statements
for (final String statement : statements) {
    conn.createStatement().execute(statement);
voidexecuteUnRegister(String schemaName, String tableName, String columnName, Connection con)
execute Un Register
String stmt = "call db2gse.ST_unregister_spatial_column(?,?,?,?,?)";
String s = "{" + stmt + "}";
CallableStatement ps = con.prepareCall(s);
ps.setString(1, quote(schemaName));
ps.setString(2, quote(tableName));
ps.setString(3, quote(columnName));
ps.registerOutParameter(4, Types.INTEGER);
ps.registerOutParameter(5, Types.CHAR);
...