By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

Problem in inserting row

P: 5
Hi friends

I am unable to insert rows which have variables rather than constant data in db2 database through jdbc.
e.g

Expand|Select|Wrap|Line Numbers
  1. String s1,s2; 
  2. TextField t1,t2;
  3. s1=t1.getText();
  4. s2=t2.getText();  
  5. try{
  6. Connection c.....;
  7. Statement st=c.createStatement();
  8. st.executeUpdate("INSERT INTO TABLE(FIRSTNAME,LASTNAME) VALUES(s1,s2)");
  9. c.close();
  10. }
please help me
Oct 13 '07 #1
Share this Question
Share on Google+
1 Reply


P: 9
What is the name of the table into which you are inserting data?

According to your script it is TABLE, which I believe is a reserved word.
In any case, I urge you to choose another tablename.
Nov 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.