my dog learned polymorphism*
The moose likes JDBC and the fly likes problem with textfield Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem with textfield" Watch "problem with textfield" New topic
Author

problem with textfield

kstalin babu
Greenhorn

Joined: May 18, 2004
Posts: 7
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

Joined: Mar 18, 2003
Posts: 281
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 ]

The nice thing about Standards is that there are so many to choose from!
Abhik Sarkar
Ranch Hand

Joined: Jun 14, 2003
Posts: 61
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

Moving this to the JDBC forum.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with textfield
 
Similar Threads
rs.updateRow() not working (..)
SQLException ORA-00927: missing equal sign
what is the problem with this code?
problem with executeupdate() please help
Switch Prog. ,Now In Arrays..???