关于java调用存储过程,高手请指教小弟一下。。。!
java代码如下:package download.action;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class dbconnection extends Action{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
Connection con =null;
DataSource ds = getDataSource(request, "datasource ");
con = ds.getConnection();
CallableStatement proc = null;
try {
proc = con.prepareCall( "{call YANGJIANP.reran01()} ");
boolean flag = proc.execute();
System.out.println(flag);
con.commit();
}catch(Exception e)
{
System.out.println(e.getMessage());
}finally {
try { proc.close(); }catch(SQLException e) {}
try { con.close(); }catch(SQLException e) {}
}
return null;
}
}
执行之后控制台信息如下:
2007/04/24 12:37:29 org.apache.struts.action.RequestProcessor process
情報: Processing a 'POST ' for path '/dbconnection '
false
为什么执行没有错误,但是执行的结果却不正确,没有实现存储过程的方法。
[解决办法]
我也有类似的问题,UP