jsp连接oracle资源没有释放掉
<%
Class.forName( "oracle.jdbc.driver.OracleDriver ").newInstance();
String url= "jdbc:oracle:thin:@202.201.13.90:1521:exam "; //其中exam为SID,即为里面建立的数据库
String uid= "guanliyuan "; //数据库里面的用户
String pwd= "exam "; //数据库里面用户的密码
Connection con = DriverManager.getConnection(url,uid,pwd);
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs=stmt.executeQuery( "select * from JUN_RADIO "); //mis数据库里面的表
rs.last();
int recordCount=rs.getRow();
rs.first();
String[] eID=new String[recordCount];
if(rs!=null)
{
int i=0;
eID[i]=rs.getString( "QUESTIONID ");
while(rs.next())
{ i=i+1;
eID[i]=rs.getString( "QUESTIONID ");
}
}
Random rand=new Random();
String switchno; //替换用
int randno1;
int randno2;
for(int i=0;i <50;i++)
{
do
{
randno1=rand.nextInt(recordCount-1);
randno2=rand.nextInt(recordCount-1);
}while(randno1==randno2);
switchno=eID[randno1];
eID[randno1]=eID[randno2];
eID[randno2]=switchno;
}
out.print( "随机产生的题号 <br> ");
for(int i=0;i <3;i++)
{
out.println( " "+i+ " "+eID[i]+ " <br> ");
}
out.println( " <center> <h2> 试题如下 </h2> </center> ");
out.println( " <hr> <br> ");
rs.beforeFirst();
String sid= " ";//试题ID号
for(int i=0;i <3;i++)
{
sid=eID[i];
while(rs.next())
{
if(rs.getString( "QUESTIONID ").equals(sid))
{
out.println( " <b> "+rs.getString( "CONTENT ")+ " </b> <br> ");