aspose file tools*
The moose likes JDBC and the fly likes how to insert into 2 different tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to insert into 2 different tables " Watch "how to insert into 2 different tables " New topic
Author

how to insert into 2 different tables

Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
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

Joined: Jul 09, 2001
Posts: 1879

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

Joined: Apr 11, 2001
Posts: 356
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

Joined: Jan 17, 2001
Posts: 71
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).]


Nitin S<br />Sun Certified Java Programmer for the Java 2 platform.<br />Tekmetrics Certified Java Programmer For the Java 2 Platform.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

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

Joined: Apr 11, 2001
Posts: 356

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to insert into 2 different tables