Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to insert into 2 different tables

 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to get the info of the user from the html page and insert them into 2 different tables in a single servlet-jdbc code.
I am using connection Pool get the connection and executeUpdate() twice. It is fine for few minutes(for 5 data) , then it is not working.
can anyone give me suggestions to solve this problem?
Thanks,
Vanitha.
[This message has been edited by Vanitha Sugumaran (edited November 30, 2001).]
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "...then it is not working..."? Does it throw a SQLException? Does it continue to process, but doesn't insert? Does it just hang? Does it stop for a while, then continue? Does it cause your hard drive to catch on fire?
You'll have to be more descriptive on the symptoms of your problem so we are better able to help you. It might help to post the relevant java code too(not too much code though!).
Jamie
 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Jamie, it is not working... i meant to say that when the user clicks the submit button.. the program is not responding.. then I had to shutdown the tomcat and restart it.

this is a code without prepared statement.
Thanks,
Vanitha.
[This message has been edited by Vanitha Sugumaran (edited November 30, 2001).]
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The code looks good, did u try printing out the return value from executeUpdate, are you seeing any errors/warnings being thrown out?
------------------
Nitin S
Sun Certified and Tekmetrics Certified Java Programmer For the Java 2 Platform.
[This message has been edited by Nitin Shivaram (edited November 30, 2001).]
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try trouble shooting your code like this:

The error catching techniques are in bold. Let us know what you discover(even a copy of the printout would help)
Jamie
[This message has been edited by Jamie Robertson (edited November 30, 2001).]
 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Nitin and Jamie,
Thanks for your replies.
Everything is fine now. I am using prepared statement. I don't know why it wasn't working before. I didn't change anything except changing it into prepared statement. Your trouble shooting technic helped.
I may post some other problems
Thanks,
Vanitha.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic