here is my jsp code(code runs ok):
press.jsp
Code:
<%@ page contentType="text/html;charset=GBK" %>
<%@ page language="java" %>
<%@ page import="javax.naming.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="net.sf.hibernate.SessionFactory" %>
<%@ page import="net.sf.hibernate.Session" %>
<%@ page import="net.sf.hibernate.Transaction" %>
<%!
javax.sql.DataSource ds;
SessionFactory sf;
Session objSession;
Transaction tx;
%>
<%
try {
Context ctx = new InitialContext();
ds = (javax.sql.DataSource)ctx.lookup("java:/OracleDS");
Connection conn = ds.getConnection();
Statement st = conn.createStatement();
String sqlStr = "select * from rkxx where rownum<=100";
ResultSet rs = st.executeQuery(sqlStr);
while(rs.next()){
out.println(rs.getString("PERSONID")+"<br>");
}
rs.close();
st.close();
conn.close();
out.println("success to connect database<br>");
out.println("start use the hibernate<br>");
sf = (SessionFactory)ctx.lookup("java:/hibernate/HibernateFactory");
for(long i=0;i<1000000000;i++)
{
objSession = sf.openSession();
//if (!objSession.isConnected())
// objSession.reconnect();
tx = objSession.beginTransaction();
com.SFHC.RepairSFHC.DB.SFHCNO objNo = new com.SFHC.RepairSFHC.DB.SFHCNO();
objNo.setv_JMZH("77777777");
objSession.save(objNo);
objSession.flush();
if(tx!=null)
tx.commit();
objSession.close();
}
out.println("succeed to mark a record!");
} catch (Exception e) {
if(tx!=null)
tx.rollback();
out.println("error!!!!!!!!!!!!!!" + e.toString());
}
finally
{
//objSession.close();
}
%>
question1:
when i visit the press.jsp url,the oracle have data,but like the press code i wrote,1000000000 will spend too long,the jsp page does't appear,it tell the error info at a few hours later:can not find the page,but in the backgound,data is still inserted to the oracle.so strange,so strange!!!!!!!the page does't work,but the data is still inserted to the oracle??????
question2:
after 30 mintue,use the other JSP page to visit the oracle,it take 40 second,but if i use the JSP page at once again,the speed to visit the oracle is very fast!!!how did it happen?why when i use the JSP page after 30 minute first time,it seems so slowly,use the jsp page at once again,the speed is so faster!!!!!(i use mbean of the jboss,and as my viewpoint,whenever i use the jsp page to vivit the oracle,the speed should be very,very fast,not after 30 minute change to so slowly)
question3: how can i get some jboss info,for example how many subsequent user is use the jboss at the same time!!!
thank you for you help!