aspose file tools*
The moose likes JDBC and the fly likes regarding adding form data to 2  tables on single click without Hibernate. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "regarding adding form data to 2  tables on single click without Hibernate." Watch "regarding adding form data to 2  tables on single click without Hibernate." New topic
Author

regarding adding form data to 2 tables on single click without Hibernate.

Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205
I have form where user can specify the username,pwd, address, roles. NOw, I need to put the username and pwd in single table and rest of the values in another table.
There is key relation is between this two tables.

How to write code in servlet to achieve this.

Please guide me.

Thanks in advance.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Moving to JDBC (that's a hint).
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Or the answer. When you write the SQL, you'll have a join between the two tables.

If you have questions once you start, post back here.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205
joing two tables in sql is fine, but do we need to write 2 sql insert statements.
Lino Larios
Greenhorn

Joined: Jun 27, 2008
Posts: 28
You could call to a stored procedure to make a more efficient job, and maybe inside the store procedure perform two inserts.

http://onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding adding form data to 2 tables on single click without Hibernate.