首页 > 其他 > 详细

使用CallableStatement的用法

时间:2016-10-18 01:41:32      阅读:197      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!