This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes How to insert form-data(.jsp) into MySql through Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to insert form-data(.jsp) into MySql through Servlets " Watch "How to insert form-data(.jsp) into MySql through Servlets " New topic
Author

How to insert form-data(.jsp) into MySql through Servlets

Thamu Gurung
Ranch Hand

Joined: Feb 02, 2010
Posts: 39
hi ,

I have a .jsp file which has a form , and that data goes to servlet and I want to pass all those datas into MYsql (in a particular database and particular table).

I am trying to make a 3-tier application. JSP being being the view , Servlets the Controller and MYsql being the database.

Hope to have the overview of the logic doing this.

Regards,


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What, specifically, are you having an issue with? Getting the form data? Using the DB?
Thamu Gurung
Ranch Hand

Joined: Feb 02, 2010
Posts: 39
hi David its with the DB.....

cant use the prepared statement...
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2885
    
  13

Thamu Gurung wrote:cant use the prepared statement...

What did you try? And, what was happened when you tried? Please TellTheDetails


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
My Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Without having enough details how you expect us to help you? Post the code where error resides....


Never try to be a hard-worker. Be a smart-worker.
My Blog
Thamu Gurung
Ranch Hand

Joined: Feb 02, 2010
Posts: 39
hi ,

The error msg which i'm getting is like this :-

java.sql.SQLException: Column count doesn't match value count at row 1

My files are like this

1.form.jsp



2. insertData.java



3. Table creation in MYSQL
-

4. Web.xml file



Please Help in this

Regards,
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Is there a trigger on the table?
Thamu Gurung
Ranch Hand

Joined: Feb 02, 2010
Posts: 39
No, there is no trigger in the table..
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
What if you try ?


It should be working.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2476
    
    7

That is well spotted, Fatih!


OCUP UML fundamental and ITIL foundation
youtube channel
Thamu Gurung
Ranch Hand

Joined: Feb 02, 2010
Posts: 39
yah ,

thankyou its working now ,, as simple mistakes ,,makes crazy ,,

please check my JSP thread,,i got problem there
abhi vazhakalil
Greenhorn

Joined: Mar 24, 2010
Posts: 4
Hey This Program works fine.
 
jQuery in Action, 2nd edition
 
subject: How to insert form-data(.jsp) into MySql through Servlets
 
Similar Threads
regarding JTable
How to store an oracle database table's data to an excel file?
How to store a table's data from oracle database into an excel file?
reading pdf's table problem
Retrieve binary file from database and send to user via web browser