File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes MS Access data insert problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "MS Access data insert problem" Watch "MS Access data insert problem" New topic

MS Access data insert problem

aparna rudra

Joined: Apr 06, 2004
Posts: 14
this is the program in servlets for inserting data in database. the program compiles but no data is inserted. can anyone help me in solving this problem.

[ added code tags, fixed smilie problem - Dave ]

[ October 26, 2004: Message edited by: David O'Meara ]

[ edit again to give it a meaningful subject name ]
[ September 21, 2005: Message edited by: David O'Meara ]
Srinivasan Madhavan

Joined: Sep 21, 2004
Posts: 10
Hi Aparna,

Just check the method attribue of the form from where you get the parameters ( 'flyfrom; ....etc). May be the form method is a POST and hence your servlet may not have called the doGet() method at all !!!

If this is not the case then try the age old method of giving System.out.println() inside the doGet() methid and find out where thy problem is

Best Regards,
aparna rudra

Joined: Apr 06, 2004
Posts: 14
hii srini

thanks for ur reply, i got the values from html and the values got printed. i donot know the problem, been trying out from past 3 days.

please any one help me. i donot understand where the problem is? i am using JBuilder software.

plzzz anyone help me.
Priyadharshini Nagarajan

Joined: Sep 24, 2004
Posts: 22

the Drivermanager.getConnection should be

DriverMagare.getconnection("jdbc dbc ata source name");

1. Be sure that the query is executing properly by checing that in sql server.
2. if it is fine use the execute method to execute the inser statement
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082

1. Are you getting any exception.
2. What is auto commit mode of Connection.
3. I dont see any commit in your code
4. what dose printStackTrace say (on which line number null point exception occurs)
5. What is followling code print
System.out.println("values u enetered are:" + i);

6. REMOVE the trim() after request.getParameter("____").trim()

seems some of your parameter is null and you are applying trim on same.

7. Check your connection if it is null or not

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Aparna, just as a design suggestion. It is best to refactor out the JDBC code and query into POJOs (Plain Old Java Object) helper classes for reuse by other Java code that might not necessarily be a Servlet. Servlets should really just handle the request and return the response, letting other helper class do the dirty work.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
nilesh Katakkar
Ranch Hand

Joined: Oct 27, 2004
Posts: 35
also try committing the transaction


nilesh<br />
Vrushank Joshi

Joined: Oct 24, 2004
Posts: 11
aparna check ur date format in sql and in java.Date...
If both are same than write one method as below...
and than see the data in the database, i think this is the problem....

R Bhatia

Joined: Nov 15, 2004
Posts: 9
Better put the query in a variable and execute like....

final String str = "INSERT INTO udetails......";

And check what values are printed on your console.

Best of Luck,
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

"R S B"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it


Thanks! and welcome to the JavaRanch!

Ajith Anand
Ranch Hand

Joined: Aug 30, 2004
Posts: 40
Are you sure you are looking for the Exceptions at the right place ???
I would suggest you replace the doGet Exception Handler from


Just to make sure that the exceptions are not getting drowned elsewhere....

LXI Technologies P Ltd
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 439
Closing your connection will commit your data to database table.

Maki Jav

Help gets you when you need it!
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

This is a JDBC problem and I should have moved it earlier. My apologies.
I agree. Here's the link:
subject: MS Access data insert problem
It's not a secret anymore!