Skip to content Skip to sidebar Skip to footer

Exception Occurred When Flushing Data] With Root Cause Java.io.IOException: Stream Closed

I want to retrieve data from database, where username = entered by the user during login. Username is entered by user in html But I am getting error as: Exception occurred when fl

Solution 1:

You should not invoke out.close in your jsp page,jsp will do it for you

So just remove below code:

<%
}
}
//remove below code
catch(Exception e)
{
    System.out.println(e);
}
out.close();
%>

For your query sql,since you have use PreparedStatement ,so you need pass parameter like ps.setString() instead of write in the sql directly,so change to below:

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/vikas","root","rass");  
PreparedStatement ps=con.prepareStatement("select * from Student_Data where UserName=?");
ps.setString(1,uname);

Post a Comment for "Exception Occurred When Flushing Data] With Root Cause Java.io.IOException: Stream Closed"