aspose file tools*
The moose likes JDBC and the fly likes Unable to create connection to MS-access database from JSP form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unable to create connection to MS-access database from JSP form" Watch "Unable to create connection to MS-access database from JSP form" New topic
Author

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

Divyya Joshi
Ranch Hand

Joined: Jul 15, 2010
Posts: 102
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Divyya Joshi
Ranch Hand

Joined: Jul 15, 2010
Posts: 102
Bear, i will keep this in mind.
Please help me toh correct this.
Nauman Hasan
Ranch Hand

Joined: Jul 27, 2005
Posts: 34
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

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

Joined: Jul 15, 2010
Posts: 102
The problem is that connection is not getting created. I want to insert data but i am not able to create connection.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

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

Joined: Jul 15, 2010
Posts: 102
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:

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8



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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to create connection to MS-access database from JSP form