ホームページ  >  記事  >  データベース  >  java调存储过程

java调存储过程

WBOY
WBOYオリジナル
2016-06-07 15:28:461101ブラウズ

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 までご連絡ください。