首頁  >  文章  >  資料庫  >  java调存储过程

java调存储过程

WBOY
WBOY原創
2016-06-07 15:28:461099瀏覽

String sql = {call INIT_SORT()}; CallableStatement cs = null; Connection conn = null; ResultSet rs = null; try { conn = SessionFactoryUtils.getDataSource(getSessionFactory()) .getConnection(); conn.commit(); conn.setAutoCommit(true); cs =

String sql = "{call INIT_SORT()}";

CallableStatement cs = null;
Connection conn = null;
ResultSet rs = null;
try {
conn = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();

conn.commit();
conn.setAutoCommit(true);

cs = conn.prepareCall(sql);
cs.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (null != rs) {
rs.close();
}
if (null != cs) {
cs.close();
}
if (null != conn) {
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn