• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, specifically, are you having an issue with? Getting the form data? Using the DB?
 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi David its with the DB.....

cant use the prepared statement...
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4328
238
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thamu Gurung wrote:cant use the prepared statement...

What did you try? And, what was happened when you tried? Please TellTheDetails
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without having enough details how you expect us to help you? Post the code where error resides....
 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a trigger on the table?
 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, there is no trigger in the table..
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you try ?


It should be working.
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is well spotted, Fatih!
 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yah ,

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

please check my JSP thread,,i got problem there
 
abhi vazhakalil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey This Program works fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic