Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving data from form

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hello everyone,

I am very new to Java, so excuse my ignorance.
I want to retrieve data from my form, located in AvailAccount - it's a select box, and load it to a Java servlet. Once in my servelet, how would I go about updating the database? I have the connection established. But don't know what is needed next to complete this.
Any help would be most appreciated.
Below is code I currently have.

import java.sql.*;
import java.util.*;

public class AccountUpdate implements java.io.Serializable {
private Vector accountUpdates = null;
private java.sql.Connection conn = null;
private static final String DBURL = "jdbc:eek:racle:thin:mad:tsc:1521:tmsdb01p";
private static final String DBLogin = "tscadmin";
private static final String DBPassword = "e1cadm1n";
private static final String driverName = "oracle.jdbc.driver.OracleDriver";



try {
Class.forName(driverName);
conn = DriverManager.getConnection(DBURL, DBLogin, DBPassword);
PreparedStatement prepStmt = null;
prepStmt = conn.prepareStatement = "INSERT INTO entitlement()..."
ResultSet resultSet = prepStmt.executeQuery();
}
}
 
Hi,

Actually you have already got the answer already :) provided your connection is successful.

In case you still didn't get it, it would be something like this:

conn = DriverManager.getConnection(DBURL, DBLogin, DBPassword);
Statement st = conn.createStatement();
int temp = st.executeUpdate("Insert INTO entitlement ...);

The variable temp would state whether the record is inserted successfully or not.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Thanks for the reply Leon.
How do I get the information from AvailAccounts, read it and store it to the update statement.
I'm not sure how this is accomplished.
Example: In the select box various accounts are listed. How do I read the contents of AvailAccounts and then feed it to the Insert statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top