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



Home Answers Viewqa JSP-Servlet value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


nayna kumari
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
0 Answer(s)      2 years and 3 months ago
Posted in : JSP-Servlet


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>

        <style type="text/css">
<!--
.style1 {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 18px;
}
-->
        </style>
</head>
    <body>
        <p> </p>
        <p> </p>
        <p> </p>
        <p> </p>
        <table width="498" height="177" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666">
          <tr>
            <td width="184" height="51"> <div align="center" class="style1">
              <div align="justify">NAME </div>
            </div></td>
            <td width="187"><label>
              <input  type="text" name="textfield" size="30">
            </label></td>
          </tr>
          <tr>
            <td height="48" class="style1"> <div align="justify">EMAIL</div></td>
            <td><input name="textfield2" type="text" size="30"></td>
          </tr>
          <tr>
            <td height="39"><div align="justify" class="style1">PASSWORD</div></td>
            <td><input name="textfield3" type="text" size="30"></td>
          </tr>
          <tr>
            <td height="39"> </td>
            <td><input type="submit" name="Submit" value="Submit"></td>
          </tr>
    </table>
           <h1> </h1>


           <form action="http://localhost:8080/WebApplication1/faces/jsp1.jsp">
               <%@page language="java" %>
               <%@ page import ="java.sql.*"  %>

      <%     String  name=request.getParameter("textfield");
              String email=request.getParameter("textfield2");
              String password=request.getParameter("textfield3");  


          try{     

    //String query ="INSERT INTO demodb VALUES('"+name+"','"+email+"','"+password+"')";
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@Nayna-PC:1521:orcl","scott","tiger");
      //Statement stmt=conn.createStatement();
    PreparedStatement ps=conn.prepareStatement("insert into demodb(name,email,password) values(?,?,?)");
     ps.setString(1,name);
    ps.setString(2,email);
    ps.setString(3,password);
    int rs=ps.executeUpdate();
   //conn.close();
    if(rs!=0){
    System.out.println("successful");
    }
    else{
    System.out.println("unsuccessful");
    }
    }
          catch(Exception e){
              System.out.println("error in connection"+e);
          }

        %>

    </form>
</body>
</html>

Advertisement
View Answers

Related Tutorials/Questions & Answers:
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.  <html> <..."> <title>JSP Page</title> <style type
Deleting a Row from SQL Table Using EJB
Deleting a Row from SQL Table Using EJB   ... to delete a row from the SQL Table. Find out the steps given below that describes how to delete a particular row from the database table using EJB. The steps
Advertisements
What?s the maximum size of a row in SQL table?
What?s the maximum size of a row in SQL table?  What?s the maximum size of a row in SQL table?   Hi, The maximum Row Size is 8060 Bytes in a sql table. Thanks
Insert Data in Table Using Stored Procedure
Insert Data in Table Using Stored Procedure   ... Your data has been inserted into table. Download this example.(Java... into a table using stored procedure. Steps: 1.Create database: To create
the last data entered into database is getting stored again after refreshing
the last data entered into database is getting stored again after refreshing  hey all i made a shout box using php and mysql but the last data... if the data is deleted from the database the last data entered is getting posted plz help
getting radio button at start of each row of table - Struts
getting radio button at start of each row of table  i have done the following things, and this is fine for me. But i want radio button at the place... at the start of each row as u saw in above output. So what should i have to do
Delete row and column from table through java code
Delete row and column from table through java code... will see how to delete row and column from given table through java code. Java code... will delete the row having minimum value of ID then delete the column named
Getting the last inserted id using jsp
Getting the last inserted id using jsp  Pls how can i retrieve the last inserted id after submitting a form to mysql using jsp
Deleting a Row from SQL Table Using EJB
Deleting a Row from SQL Table Using EJB... are going to delete a row from the SQL Table. Find out the steps given below... ===================================== Data updated successfully : See sql table to verify
same data inserted 2 times
same data inserted 2 times  thanks for reply, i know the insert command. but same data inserted 2 times.where is the problem i cannot understood
Sql row retrieve - SQL
Sql row retrieve  Sir What are the sql statements so that I can retrieve rows from a table by specifying the row numbers such as row no.5 to 10...; Sir What are the sql statements so that I can retrieve rows from a table
same data inserted 2 times in database
same data inserted 2 times in database  pls help me, i have table studentmaster(firstname,lastname,fathername,phone,address). i am inserting data into database 2 times the data will be inserted. forexample: firstname
how to display the selected row from the data table in model panel ??
how to display the selected row from the data table in model panel ?? ...:dataTable value="#{tableRecordBean.dataList}" var="dataItems" onRowClick="#{rich...="350"> <f:facet name="caption"> <h:outputText value
how insert data from databse in array and compare new data to already stored value in array
how insert data from databse in array and compare new data to already stored value in array   hello all i tried to fetch data from databse and try to stored it in an array and i want to compare new value that come from database
Convert the excel sheet data into oracle table through java or jsp
Convert the excel sheet data into oracle table through java or jsp  Hi Friends, Let me help this issue i am phasing Convert the excel sheet data into oracle table through java or jsp
SQL add column default value
SQL add column default value       Add a Column default value is used in SQL, When create statement Query is performed in SQL .Usually, the default value
Display error message if data is already inserted in database
Display error message if data is already inserted in database   Display error message if data is already inserted in database Pls help me Thanks
mysql table construction - SQL
mysql table construction  In MySql there is no pivot function. using a function or Stored Procedure, I want to loop through a column of data and create a another table that uses the row value as Column labels from the row
Hoe to refresh a table row dynamically
Hoe to refresh a table row dynamically  Want to refresh a table data... Friend, Is there a link attribute with every row of a table through which we will able to refresh a particular table row? Please clarify this. Thanks
Retriving data stored in database
Retriving data stored in database  Hi, How to retrive data from my sql database using Hibernate,Spring and tapestry please give me an example.I am new to this Hibernate and Spring
add image in a row of table
add image in a row of table  i have a table in which i have to add... a label in which instead of passing text i have inserted image using jLabel.setIcon(new ImageIcon("E:/2.jpg"));.But when i pass this jlabel in the row it shows
add image in a row of table
add image in a row of table  i have a table in which i have to add... a label in which instead of passing text i have inserted image using jLabel.setIcon(new ImageIcon("E:/2.jpg"));.But when i pass this jlabel in the row it shows
upload the text file through html and insert those data into the table
upload the text file through html and insert those data into the table  i want to take input form a text file.there is a table in database oracle... into table.now i want to upload the text file through html and insert those data
how to retrieve data from table with runtime values in sql?
how to retrieve data from table with runtime values in sql?  how to retrieve data from table with runtime values in sql? For example, I have table... value. But I dont know how to retrieve the values whenever i pass different dates
use data from database table as hyperlink value - JSP-Servlet
use data from database table as hyperlink value  I'm creating a web... to hyperlink. I want to use this data as hyperlink and use it as the value... as the hyperlink's value then pass to the next page and retrieve the complete details of the row
SQL Out Parameter
SQL Out Parameter       SQL Out Parameter allows the stored procedure to the pass data... parameter  allows the stored procedure to pass the value and pass back to the invoker
Adding button to each row for the table and adding row to another table
Adding button to each row for the table and adding row to another table  Hi I need to add button to each line in the table(Table data is retrived... row of the table
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??
How to import data from sql server table into an excel file by creating... data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase?? There is a table in sql server having
use struts 1.0 to view sql table value on JSP page
use struts 1.0 to view sql table value on JSP page  Here i am using struts 1.0 to view my sql table values on jsp page. But the problem is when i append the value in bean then i find the last row of table is shown repetedly. Any
use struts 1.0 to view sql table value on JSP page
use struts 1.0 to view sql table value on JSP page  Here i am using struts 1.0 to view my sql table values on jsp page. But the problem is when i append the value in bean then i find the last row of table is shown repetedly. Any
Table maximum Row count - JDBC
Table maximum Row count  Dear friends I want to select maximum... maximum time entry value? Thanks in advance Rajkumar  Hi friend, Sql Query for select maximum value max() function use. "select max
 

 

 

DMCA.com