首页  >  文章  >  数据库  >  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