insert values

insert values

How to insert values in the oracle database using JSP. Plz tell the core answer as soon as possible .

View Answers

April 7, 2008 at 7:22 PM

Hi

This is html page


<html>

<head>
<title>Insert value in database</title>
</head>

<body>

<table border="1" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<h1><center>Insert value in Database</center></h1>
<form method="POST" action="InsertAction.jsp">

<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="right"><b>Name:</b></td>
<td width="50%"><input type="text" name="username" size="30"></td>
</tr>
<tr>
<td width="50%" valign="right"><b>Job-Position:</b></td>
<td width="50%"><input type="text" name="jobposition" size="30"></td>
</tr>
<tr>
<td width="50%" valign="right"><b>Date:</b></td>
<td width="50%" valign="right"></td>
</tr>
</table>
<p><input type="submit" value="Submit">
<input type="reset" value="Reset"></p>
</form>
</td>
</tr>
</table>
</body>
</html>


InsertAction.jsp

<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>

<%

Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
java.util.Date date;
String s=null;
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String username=request.getParameter("username");
String jobposition=request.getParameter("jobposition");
DateFormat dformat = new SimpleDateFormat("yyyy-MM-dd");

try{
date = new java.util.Date();
s = dformat.format(date);
out.println("Today = " + s);
}
catch(Exception e){
e.getMessage();
}
int val = st.executeUpdate("insert user_details values('"+username+"','"+jobposition+"','"+s+"')");
String query = "SELECT date FROM user_details";
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
out.println(rs.getString(1) + " " + rs.getString(2) + "<br>");
}
rs.close();
con.close();
out.println("success");
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>


Here used the jdbc connection, so here, change the driver name of oracle.









Related Tutorials/Questions & Answers:
insert values - JSP-Servlet
insert values  How to insert values in the oracle database using JSP...;insert user_details values('"+username+"','"+jobposition+"... page<html><head><title>Insert value in database</title><
how to insert a summary values in grid
how to insert a summary values in grid  how to insert a summary value in grid
Advertisements
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
insert values from excel file into database
insert values from excel file into database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel... the following link: Insert values from excel file to database
can i insert values into two tables by a query - JDBC
can i insert values into two tables by a query  hi all, can i insert values into two tables by a query Thanks Bala k
want to insert values in drop down menu in struts1.3
want to insert values in drop down menu in struts1.3  I am using DynaValidatorForm.please help me with inserting values in color drop down menu. I have tried belowwith arraylist but was not able to find solution. add.jspx
How to insert data from a combobox and textbox values into DB using JSP?
How to insert data from a combobox and textbox values into DB using JSP?  hi, How to insert a comb-box and a text box values in to DB using JSP? @DB:student; @table:stu_info; Combobox values:(class1,class2,class3); textbox1
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... of dynamic textboxes with Name and Address will display....Now I want to Insert
how to Insert Array Values Into Separate Rows using java?
how to Insert Array Values Into Separate Rows using java?  how to Insert Array Values Into Separate Rows using java?  class InsertArrayValuesInSeparateRow{ public static void main(String[] args
How to extract values from SOAP Response message and insert in database
How to extract values from SOAP Response message and insert in database ... values from SOAP Response XML (i.e. Empname,EmpID,Phnumber) but I don't have any idea of XML.Also I need to update these parsed values into the database. Can you
Query to insert values in the empty fields in the last row of a table in Mysql database?
Query to insert values in the empty fields in the last row of a table in Mysql database?  I have some fields filled and some fields empty in the last row of my MYSQL database. Now I want to fill up those empty fields in the last
Facing Problem to insert Multiple Array values in database - JSP-Servlet
Facing Problem to insert Multiple Array values in database  Hai... --------------------------------------- i want to insert the data like the above database but while inserting the data in orderdetails after insert the frist value its
getting int values from form and insert it in data base in jsp
getting int values from form and insert it in data base in jsp  how can i get form input such as id convert it to int insert it into database  ...=st.executeUpdate("insert into data(name,age, address) values('"+name+"',"+age
How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  ... ,update,delete database values from jtable only so i added three buttons add,update...; JButton update; JButton insert; JButton delete; JPanel p; MyTableModel tm
How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  ... ,update,delete database values from jtable only so i added three buttons add,update...; JButton update; JButton insert; JButton delete; JPanel p; MyTableModel tm
How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  ... ,update,delete database values from jtable only so i added three buttons add...; JButton update; JButton insert; JButton delete; JPanel p; MyTableModel tm
Insert database values in the file
Insert database values in the file In this section, you will learn how to retrieve the data from the database and insert into the file. Description of code: This is a simple task. First of all we have retrieved the values from
How to compare two tables, and insert values which r not in one table to another table?
How to compare two tables, and insert values which r not in one table... insert the values to main_table... here is my sql query insert into Main_Table... queryString = ("insert into Main_Table MT (MT.serialno) values (Select SerialNo
insert
insert  insert data in database from servlet through JDBC   Ho Friend, Please visit the following:ADS_TO_REPLACE_1 Insert data into database Thanks
PHP Insert Value
to insert values into respective fields. To describe or to know the design... default value earlier, Type: insert into student values ('name', 21, 'emp_id'); Now to insert values into table:   ii)    Using WAMP
Php Sql Query Insert
Php Sql Query Insert  This example illustrates how to execute insert query with values in php application. In this example we create two mysql query for insert statement with separate values in the database table. The table before
Inserting values in MySQL database table
to insert the values in the database. Here we are going to see, how we can insert values in the MySQL database table. We know that tables store data in rows... to insert the values in specific table with the help of some APIs and methods
insert multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
Mysql Insert
Table Stu(Id int,Name Varchar(15)); Insert values into Stu...' Insert Into Stu values(1,'Ajay'); Insert Into Stu values(2,'Bhanu'); Insert Into Stu values(3,'Komal'); Insert Into Stu values(4,'Rakesh'); Insert
The INSERT INTO Statements in SQL?
The INSERT INTO Statements in SQL?  The INSERT INTO Statements in SQL?   Hi, The INSERT INTO statement is used to insert a new row or multiple rows into a table.ADS_TO_REPLACE_1 SQL INSERT INTO Syntax INSERT
jdbc insert
into the database."); st.executeUpdate("insert into user(id,name,address) values(1111...jdbc insert  Hi , i want to insert a declared integer variable into a mysql table through jdbc. how to insert that. help me with query... thanks
insert query in mysql
insert query in mysql  insert query in mysql not working   [INSERT INTO Birthdays(firstname, lastname, birthday, group) VALUES('Sam','Smith','June','Junior
The INSERT INTO Statement, SQL Tutorial
'. . .) VALUES ('field_value', 'field_value'. . .); Insert a New Row...:ADS_TO_REPLACE_2 INSERT INTO employee  VALUES ('Amar...The INSERT INTO Statement      
The INSERT INTO Statement
; INSERT INTO 'table_name'('field_name', 'field_name'. . .) VALUES ('field_value...: INSERT INTO employee  VALUES ('Amar', 'Designer', 10000...The INSERT INTO Statement      
select tag multiple values
select tag multiple values   I want to insert multiple values in database which i have selected from select tag
Write a query to insert a record into a table
Write a query to insert a record into a table  Write a query to insert a record into a table   Hi, The query string is as follows-ADS_TO_REPLACE_1 Insert into employee values ('35','gyan','singh'); Thanks
DB Insert
DB Insert  How to insert XML data into a database column? Column data type is CLOB
How to insert rows in jTable?
How to insert rows in jTable?  Hi, I need to take input from user using JTable. I want an empty row to appear after clicking a insert button. The values will be entered in this empty row. I have searched on this but could
insert data
("insert into images values(?,?,?,?,?)"); st.setString(2...insert data  i've got a problem to insert my data to database.i can upload my multipart file but not text data.Please help me to solve this .Attached
inserting dropdown values into database table
inserting dropdown values into database table   hi i want to insert dropdown values into a database table by using jsp
How to insert data into MySQL Table?
in the insert query. Here values for all the columns is to be provided: insert into email values('Rajeev','Singh','[email protected]',500); insert into email values('Dinesh','Singh','[email protected]',200); insert into email values('John
Insert Records in Table
is given below: insert into Table values('first value',' last value');ADS_TO_REPLACE_1... country; insert into country  values('India','Delhi');ADS... Insert Records in Table     
Create table and insert data by sql query
database, insert some values and retrieve values from the table. Before running... Create table and insert data by sql query       This is detailed java program
insert image - JSP-Servlet
= connection.prepareStatement("insert into save_image(name, image) values...insert image  hi friends i am mahesh i am trying to insert image...("unsucessfull to insert image."); } psmnt.close(); connection.close
Difference between Normal Insert and BLOB insert
values(1,'Libraries\Pictures\Lotus.jpg') and 2nd row as INSERT INTO [dbo...=con.prepareStatement("insert into data(name,city,image)"+"values(?,?,?)"); psmt.setString(1...Difference between Normal Insert and BLOB insert  I have sql database
Java Multiple Insert Query
`) values ( 'Apple') insert into `fruitorder`(`fruitName`) values ( 'Orange') insert into `fruitorder`(`fruitName`) values ( 'Grapes') insert into `fruitorder`(`fruitName`) values ( 'Guava') insert into `fruitorder`(`fruitName`) values
SQL Bulk Insert Example
. insert into stu_table values (1, 'Komal',10), (2, 'Ajay',10), (3...), (5, 'eee',11); insert into stu_table values (1, 'iii',12... SQL Bulk Insert Example     
insert code jsp to access
insert code jsp to access   insert code jsp to access
Remove duplicate values
Remove duplicate values  i am trying to insert values into database... is primary key. other attributes can allow null. am trying to insert values from spreadsheet having 4 rows. statement2.executeUpdate("insert
duplicate values
duplicate values  My database having cursor that has duplicate values.i want to remove duplicate values through java application
Create After Insert Trigger in SQL
'. Whenever we perform insert values into a table 'stu_table', an insert trigger...) VALUES (user(), CONCAT('Insert Student record ', new.stu_id,' ',new.stu_name..._TO_REPLACE_4 insert into stu_table values(1, 'Komal',10); insert
JDBC insert that returns primary key
JDBC insert that returns primary key  How to write code for jdbc insert that returns primary key? Help me fast Thanks   Hi, Following code can be used: //Add record into database String queryInsert = "insert
example of before insert trigger in mysql
, subject5) values (1, 'AAA', 6, 6, 6, 6, 6); insert into student...) values (2, 'BBB', 33, 33, 33, 33, 40); insert into student(id, student_name...example of before insert trigger in mysql  Hi, How to create
reain values
if it already exits i m using reuest.sendredirect to same jsp but all textbox values are cleard, i want to retain all values in textboxs after request.sendredirect .Please
database is connected but not insert the data
=con.prepareStatement("insert into studentmaster(slno) values('"+batch+"')"); i=st.executeUpdate("insert into studentmaster(slno) values('"+batch+"')"); out.println(i...database is connected but not insert the data  hi, i am getting

Ads