JSP and Oracle
2 posts in topic
Flat View  Flat View

Posted By:   Ron_iver
Posted On:   Monday, March 26, 2001 05:26 AM

Hi, i have some problems, i'm trying to catch som values from at html page and pass them over to a Oracle database. The problem is that i only get NAME and ADDRESS into the table, not the actual name and address, like Jhon, USA..
Take a look at the code and please tell me what is wrong.

Statement stmt = conn.createStatement();
ResultSet res;
stmt.executeUpdate("insert into test values('name','address')");

If some one have an example, please show me. i'm desperate

Thank you!

Re: JSP and Oracle

Posted By:   Guru_Prasad  
Posted On:   Tuesday, March 27, 2001 09:52 AM


first thing is that u should get the values from the html page like this,
String name = request.getParameter("NAME");
String address = request.getParameter("ADDRESS");
here, NAME and ADDRESS are the name given in the html page.

then u write a query like this,

stmt.executeUpdate(" insert into test values('" + name + "', '" + address +"');

i think this whould work.

Re: JSP and Oracle

Posted By:   Truly_Rural  
Posted On:   Monday, March 26, 2001 08:06 AM

I'm not very familiar with JSP ( being on the Microsoft side of the hedge at the moment ;-) ) , but I believe the statement
stmt.executeUpdate("insert into test values('name','address')");

should be replaced with

stmt.executeUpdate("insert into test values('" +
request.form('name') + "', '" +
request.form('address')+ "')";

or its equivalent in JSP
About | Sitemap | Contact