标签:
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();
}
}
}
标签:
原文地址:http://www.cnblogs.com/liuruiguang/p/5971603.html