数据的查询:
Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
Connection conn = null;
Properties props = new Properties();
props.put("user", "sa");
props.put("password", "123");
conn = DriverManager.getConnection("jdbc:derby://localhost:1527/test;", props);
conn.setAutoCommit(false);
Statement s = conn.createStatement();
String ssntemp, sqlstr;
ssntemp = request.getParameter("ssnstr");
int ssni;
ssni=Integer.parseInt(ssntemp);
sqlstr = "select status from loaner where ssn=3";
ResultSet rs = s.executeQuery(sqlstr);
String statusstr="";
while (rs.next()) {
StringBuilder builder = new StringBuilder(rs.getString(1));
statusstr=builder.toString();
}
out.println("你的申请状态:"+statusstr);
rs.close();
s.close();
conn.commit();
conn.close();
给你个参考