Home Discussion Discuss: JPA executeUpdate

  • executeUpdate not working.Mansi January 8, 2012 at 6:55 PM

    hi.. i'm trying to insert data to sql from jsp.. but its not inserted.. my code is as below.. pls correct it .. <%-- JSP directive --%> <%@ page import="java.net.*, java.io.*, java.sql.*, java.util.* " %> <%-- JSP scriplet --%> <% String url = "jdbc:oracle:thin:@127.0.0.1:1521:XE" ; Connection con = null; Statement stmt =null; Statement stmt1; ResultSet rs = null; String uname="system"; String passwd="oracle"; String fn=request.getParameter("fname"); String ln=request.getParameter("lname"); String un=request.getParameter("uname"); String pw=request.getParameter("passwd"); String street=request.getParameter("street"); String city=request.getParameter("city"); String state=request.getParameter("state"); String zip=request.getParameter("zip"); String phone=request.getParameter("phone"); String email=request.getParameter("email"); String query; try { Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); con = DriverManager.getConnection(url, uname, passwd); stmt = con.createStatement(); out.println("1"); stmt.executeUpdate("INSERT INTO tcust (fname,lname,uname,pswd,street,city,state,zipcode,phone,email)" + "VALUES('"+fn+"','"+ln+"','"+un+"','"+pw+"','"+street+"','"+city+"','"+state+"','"+zip+"','"+phone+"','"+email+"')"); out.println("2"); out.println("4"); stmt.close(); con.close(); } catch (Exception e) {e.printStackTrace();} %>

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
JPA

JPA executeUpdate
JPA executeUpdate       In this section, we will learn how to use executeUpdate() method in your  JPA application. To use executeUpdate() method in your jpa application 

JDBC

JDBC executeUpdate() And executeQuery()
.style1 { text-align: center; } .style2 { background-color: #FFFFCC; } Statement executeQuery() and executeUpdate() Example executeQuery() method... object. executeUpdate() method is generally used by INSERT, UPDATE,  

JDBC Questions

SELECT query using executeUpdate() instread of executeQuery()
SELECT query using executeUpdate() instread of executeQuery()  can we execute SQL SELECT query using executeUpdate() instread of executeQuery() method   Hi Friend, No, You cannot. Thanks 

JDBC Questions

SELECT query using executeUpdate() instread of executeQuery()
SELECT query using executeUpdate() instread of executeQuery()  for Ex: class sample{ public static void main(String... executeUpdate() method with select quesry then you can't be able to retrieve data from 

Hibernate Questions

Hibernate delete HQL - Hibernate
Hibernate delete HQL  Hi I am trying hibernate tutorial. But delete HQL tutorial not working properly. It gives null pointer exception. Query class has method executeUpate() & not executeUpdate 

Java Beginners

excel file using JDBC java.?
executeupdate query. can you help me do 

Java Beginners

"compilation error " & "throw an exception" - Java Beginners
executeUpdate()." Thanks 

JDBC

JDBC add batch, JDBC add batch Example, JDBC add batch example code
from executeUpdate(), as the executeUpdate() will execute one query at a time 

Hibernate Questions

Delete HQL query - Hibernate
Delete HQL query  Hi I am trying hibernate tutorial. But delete HQL tutorial not working properly. It gives null pointer exception. Query class has method executeUpate() & not executeUpdate(); log4j:WARN No appenders 

Java-Tutorials

JDBC: Insert Records Example
(): It is a method of Connection interface which returns Statement object. executeUpdate... and call method executeUpdate(). package jdbc; import java.sql.Connection 

JDBC

JDBC Logging Example
= conn.createStatement(); try { st .executeUpdate("create table StudentLog (RollNo int,Name varchar(30));"); st .executeUpdate("insert into StudentLog (RollNo,Name ) values (1,'Rahul')"); st .executeUpdate("insert 

Java-Tutorials

JDBC: Drop Table Example
Statement object. executeUpdate(String sql): This method of Statement interface.... Write query of drop table and call executeUpdate(sql)  method to execute 

Java-Tutorials

JDBC: Drop Database Example
which returns Statement object. executeUpdate(String table): This method... to the database, using jdbc API. Write query of drop database and call executeUpdate(sql 

JPA

JPA Examples In Eclipse
() method is your JPA application.   JPA executeUpdate In this section, we will learn how to use executeUpdate() method in your  JPA... JPA Examples In Eclipse    

JDBC

Inserting Records using the Prepared Statement
in the movies table by the help of executeUpdate method then it will show... is not executed!" . The executeUpdate method also executes the SQL statement 

MySQL

Rename column name of table using DBCP
;       .executeUpdate("ALTER  

Java-Tutorials

JDBC: Delete Record using Prepared Statement
condition. executeUpdate(String sql): This method executes SQL statements(insert 

Java-Tutorials

Update Record using Prepared Statement
field or many fields under certain condition. executeUpdate(String sql 

Java-Tutorials

JDBC: Insert Record using Prepared Statements
of Statement. executeUpdate(String sql): This method executes SQL statements 

Java Code Examples

Insert current date into MYSQL database
executeUpdate() saves the data to database 

JSP Servlet Questions

Uploading an image into the table - JSP-Servlet
())); /* executeUpdate() method execute specified sql query. Here this query 

Java Technology Tutorials

Insert file data into database
= splitSt[3]; } int k = st .executeUpdate("insert into student(id 

SQL Question

java
. The method executeUpdate() is used to insert the data. Moreover, you haven't 

Java Beginners

how to insert and retrieve an image from mysql using java - Java Beginners
())); /* executeUpdate() method execute specified sql query. Here this query insert 

JDBC Questions

Sequence generator problem - JDBC
.executeUpdate("insert into massemaildetails values(massemaildetails_seq.nextval 

JSP Servlet Questions

JSP Error - JSP-Servlet
executeUpdate(String qry) { int i=0; try{ i=st.executeUpdate(qry 

Programming Tutorials

Add new column to table using DBCP
        .executeUpdate(" 

Programming Tutorials

Natural Join of tables using DBCP
; .executeUpdate("ALTER TABLE emp CHANGE  

JDBC-Tutorials

Complete JDBC Tutorial
() And executeUpdate() - In this tutorial you will see an example of JDBC executeQuery() and executeUpdate() Iterating though ResultSet - In this tutorial you 

JSP Tutorials

Change Password Code in JSP
if a ResultSet object can be retrieved and otherwise return false. executeUpdate(String MySQL):-The executeUpdate(String MySQL) is a return thr no or rows 

DMCA.com