<%
Connection conn = null;
Statement stmt = null;
String name1 = null;
String name2 = null;
String email = null;
String id = null;
String pwd = null;
try {
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
conn=DriverManager.getConnection("jdbc:ucanaccess:////C:\\Users\\faheem\\Documents\\NetBeansProjects\\WebApplication2\\Database1.accdb");
stmt = conn.createStatement();
String sql;
sql = "SELECT * FROM Database1";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next())
{
id = rs.getString("ID");
name1 = rs.getString("Username1");
name2 = rs.getString("Username2");
pwd = rs.getString("Password");
if(sess.getAttribute("username").equals(name1) || sess.getAttribute("username").equals(name1))
{
email = rs.getString("Email");
break;
}
}
rs.close();
stmt.close();
conn.close();
}
catch(ClassNotFoundException e){
} catch (SQLException e) {
}
finally{
//finally block used to close resources
try{
if(stmt!=null)
stmt.close();
}catch(SQLException se2){
}// nothing we can do
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
}//end finally try
%>
<% } %>
User-ID :
<%=id%>
First Name :
<%=name1%>
Last Name :
<%=name2%>
Email :
<%=email%>
Password :
<%=pwd%>
<% } %>






















