| Author |
problem with executeupdate() please help
|
kstalin babu
Greenhorn
Joined: May 18, 2004
Posts: 7
|
|
hello one and all, i am new to java and in learning stage. i got a small problem... here is the code String scn=bcrc_scno.getText(); int prn=Integer.parseInt(bcrc_prno.getText()); int mamt=Integer.parseInt(bcrc_misamt.getText()); int recon=Integer.parseInt(bcrc_reconchg.getText()); String brn=bcrc_brno.getText(); String ptr=bcrc_ptrdt.getText(); String mamtcd=bcrc_misamtcd.getText(); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("Jdbc dbc:venkat","scott"," tiger"); con.setAutoCommit(false); Statement stmt = con.createStatement(); System.out.println("connection established......XXXXXXXXXXX"); /* columns in the table payment1 ptscno,ptprno,ptmisamt,ptreconchg,ptbcrno,ptprdt,ptmisamtcd */ stmt.executeUpdate("insert into payment1(ptscno,ptprno,ptmisamt,ptreconchg,ptbcrno,ptprdt,ptmisamtcd) values (scn,prn,mamt,recon,brn,ptr,mamtcd)"); con.commit(); con.setAutoCommit(true); con.close(); }catch(SQLException p){ System.out.println("sorry failed"+p); p.printStackTrace(); }catch(Exception e){ System.out.print(e); } after executing this i am getting column not allowed oracle error ----------- i have taken the data from a textfield. please help me thanq in advance stalin.
|
 |
Ashok Mash
Ranch Hand
Joined: Oct 13, 2000
Posts: 1936
|
|
Originally posted by kstalin babu: ............. /* columns in the table payment1 ptscno,ptprno,ptmisamt,ptreconchg,ptbcrno,ptprdt,ptmisamtcd */ stmt.executeUpdate("insert into payment1(ptscno,ptprno,ptmisamt,ptreconchg,ptbcrno,ptprdt,ptmisamtcd) values (scn,prn,mamt,recon,brn,ptr,mamtcd)"); ......
Shouldn't that line be something like to get the values of the variables in the SQL that you are generating?
|
[ flickr ]
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
Do as Akash suggested and also why are you doing this con.setAutoCommit(true); Once you have set con.setAutoCommit(false) then there is no need to do this again and set the sutocommit as true
|
 |
Urmil Shah
Greenhorn
Joined: May 18, 2004
Posts: 1
|
|
To comply with the J2EE 1.3 standard, the DB2 JDBC driver, as of |FixPak 5, no longer allows the use of a non-query statement with executeQuery, |nor a query statement with executeUpdate. Attempting to do so will |result in one of the following exceptions: CLI0637E QUERY cannot be found, |CLI0637E UPDATE cannot be found. ||If the type of statement is unknown, use execute().
|
 |
 |
|
|
subject: problem with executeupdate() please help
|
|
|