Rumah  >  Artikel  >  pangkalan data  >  java调存储过程

java调存储过程

WBOY
WBOYasal
2016-06-07 15:28:461101semak imbas

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();
}
}

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn