java 調預存程序

來源:互聯網
上載者:User



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

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.