Solved

databases and Servlets

Posted on 2002-03-22
2
267 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.
Suggested Courses

623 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