package jdbctest01;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import com.lile.jdbc.util.DBUtil;
public class Demo2 {
public static void main(String[] args) {
//连接数据库
Connection conn = DBUtil.getConnection();
PreparedStatement pst = null;
try {
CallableStatement cs=conn.prepareCall("{call sp06(?,?)}");
cs.setInt(1, 1);
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
String bookName = cs.getString("t_bookName");
DBUtil.closeConn(conn, pst);
System.out.println("bookName:"+bookName);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}