*
The moose likes JDBC 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
Bookmark "MS Access data insert problem" Watch "MS Access data insert problem" New topic
Author

MS Access data insert problem

aparna rudra
Greenhorn

Joined: Apr 06, 2004
Posts: 14
hiii
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
Greenhorn

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,
Srini
aparna rudra
Greenhorn

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
Greenhorn

Joined: Sep 24, 2004
Posts: 22
hi

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: 1081

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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
nilesh Katakkar
Ranch Hand

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

connection.commit()


nilesh<br />neilindallas@hotmail.com
Vrushank Joshi
Greenhorn

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...
con.commit();
and than see the data in the database, i think this is the problem....

Regards,
Vrushank
R Bhatia
Greenhorn

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

final String str = "INSERT INTO udetails......";
System.out.println(str);
st.executeUpdate(str);

And check what values are printed on your console.

Best of Luck,
R S
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
Ajith Anand
Ranch Hand

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


to


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


LXI Technologies P Ltd
[url]www.lxisoft.com[/url]
Maki Jav
Ranch Hand

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

Maki Jav


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

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: http://aspose.com/file-tools
 
subject: MS Access data insert problem
 
Similar Threads
facing a problem
servlets
Getparameter and then display a record--how?
How to retrive values from the database
MySQLSyntaxErrorException