存储过程:
drop proc h
create proc h 
@a int,@b int,@c int output
as
set @c=@a+@b
go
declare @c int
exec h 1,2,@c output
print @c
在java里面:
CallableStatement cs = null;
        try {
            cs = DBConn.getConnection().prepareCall("{call h(?,?,?)}");
            cs.setInt(1,1);
            cs.setInt(2,2);
            cs.registerOutParameter(3, java.sql.Types.INTEGER);
            cs.execute();
            int temp=cs.getInt(3);
            cs.close();
            System.out.println(temp);
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
出错内容:
java.sql.SQLException: Output parameter not allowed as argument list prevents use of RPC.
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:993)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:478)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:478)
at procdemo.Test3.main(Test3.java:19)