Here you can find the source of executeUpdateNoCommit(Connection c, String query)
Parameter | Description |
---|---|
c | c |
query | query |
Parameter | Description |
---|---|
SQLException | SQLException |
public static int executeUpdateNoCommit(Connection c, String query) throws SQLException
//package com.java2s; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; public class Main { /**//from w w w . j a v a 2 s . c o m * executeUpdateNoCommit * * @param c * c * @param query * query * * @return DOCUMENT ME! * * @throws SQLException * SQLException */ public static int executeUpdateNoCommit(Connection c, String query) throws SQLException { int rowsUpdated = -1; Statement st = c.createStatement(); try { rowsUpdated = st.executeUpdate(query); } catch (SQLException ee) { throw ee; } finally { try { if (st != null) { st.close(); } } catch (Exception ex) { } } return rowsUpdated; } /** * executeUpdate * * @param c * c * @param query * query * * @return DOCUMENT ME! * * @throws SQLException * SQLException */ public static int executeUpdate(Connection c, String query) throws SQLException { int rowsUpdated = -1; Statement st = c.createStatement(); try { rowsUpdated = st.executeUpdate(query); } catch (SQLException ee) { System.err.println("Caught while running query\t" + query); ee.printStackTrace(); throw ee; } finally { try { if (st != null) { st.close(); } } catch (Exception ex) { } } return rowsUpdated; } }