Home Answers Viewqa JSP-Servlet insert values

 
 


yogita
insert values
1 Answer(s)      5 years and 2 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 .

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 Pages:
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
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
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
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
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
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 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
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
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
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
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 multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
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
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
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
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
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
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
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 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
select tag multiple values
select tag multiple values   I want to insert multiple values in database which i have selected from select tag
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
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
code for insert button
code for insert button    i want code for insert button(in image) . This is to be used for inserting the values in mysql databases   ..."); PreparedStatement pstmt = conn.prepareStatement("insert into data(name
How to insert clob data??
= con.prepareStatement("insert into article(subject, body)values...How to insert clob data??  Can any one tell me in details how... to insert more than 4000 characters.I have heard that clob fields can hold 4 gb
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
insert
insert  insert data in database from servlet through JDBC   Ho Friend, Please visit the following: Insert data into database Thanks
SQL Bulk Insert Example
. insert into stu_table values (1, 'Komal',10), (2, 'Ajay',10...',11), (5, 'eee',11); insert into stu_table values (1, 'iii',12... SQL Bulk Insert Example      
unable to insert data into database
unable to insert data into database    hello.i have a problem...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert into emp_timesheet values(?,sysdate,?,?,?,?)"); ps2.setInt(1,rs
unable to insert data into database
unable to insert data into database    hello.i have a problem...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert into emp_timesheet values(?,sysdate,?,?,?,?)"); ps2.setInt(1,rs
unable to insert data into database
unable to insert data into database    hello.i have a problem...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert into emp_timesheet values(?,sysdate,?,?,?,?)"); ps2.setInt(1,rs
unable to insert data into database
unable to insert data into database    hello.i have a problem...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert into emp_timesheet values(?,sysdate,?,?,?,?)"); ps2.setInt(1,rs
EJB Insert data
.style1 { color: #FFFFFF; } EJB Insert data... describes you the way  to insert data into the database using EJB. The steps...;sec-3,D-16/116,Rohini";   private int insert;   
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
Mysql Multiple Date Insert
Mysql Multiple Date Insert       Mysql Multiple Column Insert is used to add or insert... illustrate an example from 'Mysql Multiple Column Insert'. To understand an example
Mysql Multiple Date Insert
Mysql Multiple Date Insert       Mysql Multiple Column Insert is used to add or insert... illustrate an example from 'Mysql Multiple Column Insert'.To understand
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
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
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
SQL Bulk Insert Example
' with respective values. insert into stu_table values (1..., 'Bhau',10); insert into stu_table values (1, 'aaa',11), (2, 'bbb',11... SQL Bulk Insert Example      

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.