1. Stored Procedures: CallableStatement
Synatax for a procedure that doesn't return a result is {call procedure_name(.., >>)}, Synatax that return a result value is {?= call procedure_name(.., ..)}. Using like below:
CallableStatment cstmt = con.prepareCall("{call p_name(.., ..)}"); // like PreparedStatement
cstmt.registerOutParameter(col_num, java.sql.Types.FLOAT); //declear that the type of the value returned if FLOAT
cstmt.setInt(col_num, value);
cstmt.execute();
cstmt.getFloat(col_num);
2.Binaries and Books: ResultSet.getAsciiStream() handles large text strings, getBinaryStream() works for large binary objects.
When reading from InputStream(from getAsciiStream()), the servlet doesn't get the value of any other columns in the result set, because calling any other getXxx() metod of ResultSet closes the InputStream.
本文介绍了如何使用CallableStatement调用存储过程,并说明了不同情况下返回结果的语法。此外,还探讨了处理大型文本字符串和二进制对象的方法,包括使用ResultSet的getAsciiStream()和getBinaryStream()。
760

被折叠的 条评论
为什么被折叠?



