Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

selecting from oracle via servlets

 
j deming
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have entered data into an oracle table using the following syntax:
String rock = "INSERT INTO table (FIRST_NAME) VALUES(?)" PreparedStatement ps = conn.prepareStatement(rock);

ps.setString(1,firstName);
ps.executeUpdate();
where:
firstname = request.getParameter(name);
My question is how do I select from the table when the value I want is held in a variable (i.e. firstname)?
Thanks
 
DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting data back from Oracle is the same as about any db. Create a query IE: query = "SELECT firstName from [dbname] where [parameters]";
Statement stmt = conn.createStatement ();
stmt.executeQuery(query);
then use an if (rs.next()) or while (rs.next()) to pull the info from the db.............hope this helps
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!