Java JDBC Connection Close ClosePhase(long phaseId, Connection con)

Here you can find the source of ClosePhase(long phaseId, Connection con)

Description

This method set status to close of specified phase.

License

Open Source License

Parameter

Parameter Description
phaseId phase id to update.
con connection to use.

Exception

Parameter Description
Exception if any error occurred.

Declaration

static void ClosePhase(long phaseId, Connection con) throws Exception 

Method Source Code


//package com.java2s;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Main {
    /**/*from   w ww  . ja  v  a2  s  .  c  o m*/
     * This method set status to close of specified phase.
     *
     * @param phaseId phase id to update.
     *
     * @param con connection to use.
     *
     * @throws Exception if any error occurred.
     */
    static void ClosePhase(long phaseId, Connection con) throws Exception {
        executeStatement(con, "UPDATE project_phase SET phase_status_id = 3 WHERE project_phase_id = " + phaseId);
    }

    /**
     * Insert data into the database.
     *
     * @param con the connection instance
     * @param sql the sql to be executed
     *
     * @throws SQLException if any sql error
     */
    static void executeStatement(Connection con, String sql) throws SQLException {
        PreparedStatement ps = con.prepareStatement(sql);
        ps.executeUpdate();
    }
}

Related

  1. close(Connection rs)
  2. close(Object obj)
  3. closeConnection(Closeable... closes)
  4. closeIfNotNull(Connection conn)
  5. closeJDBC(Object obj)
  6. closeQuietly(MongoClient mongoClient)
  7. closeResources(Object[] resources)
  8. closeSilently(@WillClose Connection c)