Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with textfield

 
kstalin babu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello one and all,
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.
 
Eddie Vanda
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not an Oracle expert, but I suggest you use the same structure of the query but only update one column at a time to see which column is causing the problem. Also check whether any of your named columns are not updatable, e.g. autonumber.
[ May 18, 2004: Message edited by: Eddie Vanda ]
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think you should be using something like the following instead:



(hope I got all the 's and the brackets right).

Alternately, you could also consider using the PreparedStatement (see API docs for more details).

HTH,

Abhik.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic