• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to create connection to MS-access database from JSP form

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
I am facing problem adding data from JSP form page into MS-Access(database). Please help me correct this.

Here's the code
1. form.jsp



2. insert.jsp




Please help me correct it
Thanks in advance.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not something you should be doing in a JSP. Java code in a JSP is a bad practice that has been discredited for 10 years now. Time to update your JSP knowledge.

In any case, this is a JDBC issue, not a JSP issue, so the post has been moved to the JDBC forum.
 
Divyya Joshi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear, i will keep this in mind.
Please help me toh correct this.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Bear has stated the functionality in the insert.jsp should be in a Java class. You can create a servlet class and place the functionality in there. If you are having trouble the post the issue....

Here is an explanation of the pattern (MVC) which is really what you would be implementing.

Java World MVC

Regards,
Nauman
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Divyya Joshi wrote:Please help me toh [sic] correct this.


Correct what? You showed some code but aren't telling us what the problem is.

Read: TellTheDetails, ItDoesntWorkIsUseless
 
Divyya Joshi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is that connection is not getting created. I want to insert data but i am not able to create connection.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read ItDoesntWorkIsUseless again.

Just telling us that it doesn't work doesn't give us any information to go on.

Step 1: move the code out of a JSP and into a Java class where it not only belongs, but where it will be easier to manage and debug.

Then tell us the details of the problem.
 
Divyya Joshi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What i am getting is an error in line number 14 and 16. I think it means connection is not getting created.

Here's the code:

 
Marshal
Posts: 28271
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So that isn't going to work.

I don't believe you ever posted the exact error message. You should always read the error message, and if you're asking a question about it here on the forum then you should post the error message here as part of your question.
 
reply
    Bookmark Topic Watch Topic
  • New Topic