Solved

databases and Servlets

Posted on 2002-03-22
2
262 Views
Last Modified: 2013-11-24
Guys I have problem with my servlet.Can somebody send me a code of how to send data to a database please. I have tried to do it and gives me a lot of errors. I am able to get data from the database but I cannot send a new data to a database e.g sending new data like the name of a person and all his particulars. Can somebody rescue me
0
Comment
Question by:wbmorapedi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Expert Comment

by:m_onkey_boy
ID: 6890121
Since you can retrieve data, I'll asume you have the drivers and such correct.  An insert:

PreparedStatement pst = conn.prepareStatement("INSERT into Person (FirstName, LastName, Age) VALUES (?, ?, ?)");
pst.setString(1, "Bob");
pst.setString(2, "Dobbs");
pst.setInt(3, 40);
pst.executeUpdate();

Be sure you are using executeUpdate() as executeQuery() will blow.
0
 
LVL 4

Accepted Solution

by:
m_onkey_boy earned 15 total points
ID: 6890124
PS:  You should award the points on your abondoned questions or people will not help you.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql import cannot be resolved jsp 3 117
going to wrong jsp page 2 71
SequenceInputStream example 3 39
Java basic valueOf question 1 51
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question