Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet insert values

Have Programming Question? Ask it here!
 
 
 


yogita
insert values
1 Answer(s)      6 years and 5 months ago
Posted in : JSP-Servlet


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


Advertisement
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
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
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
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
insert
insert  insert data in database from servlet through JDBC   Ho Friend, Please visit the following: Insert data into database Thanks
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
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... of code: INSERT table_name VALUES(field_values): Above code is used, when you want
Mysql Insert
)); Insert values into Stu The insert into is used to add the records or rows value to the table 'Stu' Insert Into Stu values(1,'Ajay'); Insert Into Stu values(2,'Bhanu'); Insert Into Stu values(3,'Komal'); 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 multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
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. SQL INSERT INTO Syntax INSERT INTO table_name VALUES
The INSERT INTO Statement, SQL Tutorial
: INSERT INTO 'table_name'('field_name', 'field_name'. . .) VALUES...: INSERT INTO employee  VALUES ('Amar', 'Designer', 10000...: INSERT INTO employee (emp_name, Position, email_id) VALUES ('Vinod
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
DB Insert
DB Insert  How to insert XML data into a database column? Column data type is CLOB
The INSERT INTO Statement
the given below code: INSERT INTO employee  VALUES ('Amar...The INSERT INTO Statement       The INSERT INTO statement is used to insert or add a record
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
select tag multiple values
select tag multiple values   I want to insert multiple values in database which i have selected from select tag
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
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- Insert into employee values ('35','gyan','singh'); Thanks
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
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
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
Java Multiple Insert Query
: insert into `fruitorder`(`fruitName`) values ( 'Apple') insert into `fruitorder`(`fruitName`) values ( 'Orange') insert into `fruitorder`(`fruitName`) values ( 'Grapes') insert into `fruitorder`(`fruitName`) values ( 'Guava
Insert Records in Table
is given below: insert into Table values('first value',' last value'); The insert... Insert Records in Table       The Insert data in Table is used to insert  records or rows
duplicate values
duplicate values  My database having cursor that has duplicate values.i want to remove duplicate values through java application
insert code jsp to access
insert code jsp to access   insert code jsp to access
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
Values to listbox
Values to listbox  I have two textboxes by the name street and city.I have an add button and a name listbox. When I enter street and city and press the add button ,all the names of the people residing there are listed in listbox
SQL Bulk Insert Example
' with respective values. insert into stu_table values (1...), (5, 'Bhau',10); insert into stu_table values (1, 'aaa',11), (2...); insert into stu_table values (1, 'iii',12), (2, 'jjj',12), (3, 'kkk',12
Retrive Values
Retrive Values  I want to retrive the values between the td by the id using the javascript.So please help me... html form like this <TABLE width="100%" bgColor=""> <TR> <TD ID="td1">Cell 1</TD>
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
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
insert query in jsp
insert query in jsp  give me insert code in jsp at run time
single query to insert the data
single query to insert the data  How to insert data for all HTML fields in single MYSQL query
jtable insert row swing
jtable insert row swing  How to insert and refresh row in JTable?   Inserting Rows in a JTable example
Advertisements
 

 

 

DMCA.com