This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with textfield

 
kstalin babu
Greenhorn
Posts: 7
  • 0
  • 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: 281
  • 0
  • 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
  • 0
  • 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
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic