wood burning stoves*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 3179
    
  49

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
What would SCJP exam questions look like? -- Home -- Twitter -- 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: 2504
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert form-data(.jsp) into MySql through Servlets