Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

executeupdate() not actually updating table!!!----very very urgent!!!

843854Sep 23 2003 — edited Sep 24 2003
hi,
i request you for your kind help as soon as possible. the problem is. i am connecting to the MS-Access table throught the DSN and doing a executeUpdate to update a particular record in the table. everything is working fine...i am not getting any error. also the executeupdate method is returning a integer value '1'. which means the record is updated sucessfully, but for some silly reason the table is not showing any changes...
i searched some previous arichives on this not of much help!!
also i tried to create a new DSN just to test this problem to make sure there are no locks...i am pasting a code section of that part...please, help me soon as i have to show this by tommorrow...i am unable to think any other options....

name1 = br.readLine();
String query="select * from gwdb where item_status='"+"hold"+"' and isbn='"+name1.trim()+"'";
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query.trim());
if(rs.wasNull()){
System.out.println("Failed");
obj.sendConfirmation("No such book is available!");
}
else if(rs.next()){//the rs will have only one record
String isb = rs.getString(1).trim();
String sta = rs.getString(5).trim();
if(sta.equals("hold")){ //this condition is just to make sure but actually not needed
que="UPDATE gwdb SET item_status='"+"out"+"' where isbn='"+isb.trim()+"'";
Statement st0 = con.createStatement();
ans = st0.executeUpdate(que.trim());
System.out.println("ans:"+ans);//this is returning '1'
}
rs.close();
}

please, let me know if i am still not clear
anticipating your help
pre_pra

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2003
Added on Sep 23 2003
7 comments
783 views