我直接在我的数据库界面中执行了相同的查询,结果得到了两行......我想我也应该在这里得到同样的结果......但它只返回一个,第二个它说列索引超出范围 2> 1!!!
session= request.getSession();
String name=(String)session.getAttribute("user");
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mutualfund", "root", "");
Statement statement = connection.createStatement();
String qry="SELECT `account_type_id` FROM `cust_accounts` WHERE `cust_id`=\""+name+"\"";
ResultSet rs = statement.executeQuery(qry) ;
if(!rs.next())
{
out.println("Server Down.. Please try again later ");
}
else {
String one=rs.getString(1);
String two=rs.getString(2);
}