below part of code. keep getting errors database part. i've looked them multiple places , can't seem find answer. suggestions? code , what's printed errors shown below!
public void deleteemployee() { string sqlquery; sqlquery = "delete javauser.employee"; system.out.println(sqlquery); senddbcommand(sqlquery); } public void deleteaccident() { string sqlquery; sqlquery = "delete javauser.accident"; system.out.println(sqlquery); senddbcommand(sqlquery); } public void deletetruck() { string sqlquery; sqlquery = "delete javauser.truck"; system.out.println(sqlquery); senddbcommand(sqlquery); } public void deletehomestate() { string sqlquery; sqlquery = "delete javauser.homestate"; system.out.println(sqlquery); senddbcommand(sqlquery); } public void deletecountry() { string sqlquery; sqlquery = "delete javauser.country"; system.out.println(sqlquery); senddbcommand(sqlquery); }
here errors keep popping up:
run: delete javauser.homestate java.sql.sqlexception: ora-01002: fetch out of sequence delete javauser.country java.sql.sqlexception: ora-01002: fetch out of sequence delete javauser.truck java.sql.sqlexception: ora-01002: fetch out of sequence delete javauser.accident java.sql.sqlexception: ora-01002: fetch out of sequence delete javauser.employee java.sql.sqlexception: ora-01002: fetch out of sequence
also, call delete methods in order when program presses "insert button"
how can rid of these error messages?
here's senddbcommand:
public static void senddbcommand(string sqlquery) { string jdbcconnectionurl = "jdbc:oracle:thin:@localhost:1521:xe"; string userid = "javauser"; string userpass = "javapass"; try { connection conn = getdbconnection(jdbcconnectionurl, userid, userpass); stmt = conn.createstatement(resultset.type_scroll_sensitive, resultset.concur_read_only); rset = stmt.executequery(sqlquery); int traverse = 0; while (rset.next()) { system.out.println(rset.getstring(1) + " " + rset.getstring(2)); } } catch (sqlexception e) { system.out.println(e.tostring()); } }
you should include counter , print result, maybe should have clue, , well, delete there no resultset should executeupdate instead.
Comments
Post a Comment