jdbc program..using hashMap
807605Oct 15 2007 — edited Oct 17 2007public Map userprivss(int usercode){
Map data=null;
try{
con=getconnection();
data=new HashMap();
pstmt=con.prepareStatement("select privs from PRIV_USERS where ucode=?");
pstmt.setInt(1,usercode);
rs=pstmt.executeQuery();
while(rs.next())
{
data.put(rs.getString(1),rs.getString(1));
}
}catch(Exception e){
e.printStackTrace();
System.out.println ("exception in select statement" +e.getMessage());
}
System.out.println("(((((((((((((()))))))))))))))))" +data);
return data;
}
public static void main(String args[])
{
checkselect ch=new checkselect();
int ucode=1;
Map selectvals=null;
selectvals=new HashMap();
selectvals=ch.userprivss(ucode);
System.out.println(selectvals);
i dont knw why itz not printing out data.it keeps saying exception in select statement ,no data found..i really need a quick answer..thankyou in advance..