码迷,mamicode.com
首页 > 其他好文 > 详细

使用CallableStatement的用法

时间:2016-10-18 01:42:01      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:

package Test;

import java.sql.*;

public class Test7 {
public static void main(String[] args) {
Connection con=null;
CallableStatement csta=null;

try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=stuDB","sa","123456");
csta=con.prepareCall("{call sho(?)}");
csta.registerOutParameter(1, java.sql.Types.INTEGER);
csta.execute();
System.out.println(csta.getInt(1));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}

}

使用CallableStatement的用法

标签:

原文地址:http://www.cnblogs.com/liuruiguang/p/5971603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!