Cannot insert into database

Can any body help plzzzzzzzzzzzzzzzz,
I establish a connection using connection pooling as given in netbeans
helps.With that ican retrieve data from database but cant insert into it.While inserting only null values ere entered into database.why?
please somebody help

My Jsp page userRegistration.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        </head>
    <body>
<html:errors/>
    <table>
<html:form action="reg.do"method="post" >
<tr>
<td>
firstname<html:text  property="firstName"  />
</td>
</tr>
<tr>
<td>
lastname<html:text property="lastName" />
</td>
</tr>
<tr>
<td>
username<html:text property="userName" />
</td>
</tr>
<tr><td>
email<html:text property="email" />
</td>
</tr>
<tr>
<td>
phone<html:text property="phone" />
</td>
</tr>
<tr>
<td>
fax<html:text property="fax" />
</td>
</tr>
<tr>
<td>
password<html:password property="password" />
</td>
</tr>
<tr><td>
passwordcheck<html:password property="passwordCheck" />
</td>
</tr>
<tr>
<td>
<html:submit />
</td>
<td>
<html:cancel />
</td>
</tr>
</table>
</html:form>
</body>
</html>
my struts action
package action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import javax.servlet.http.HttpSession;
public class reg extends Action {
     private String firstName;
    private String lastName;
    private String userName;
           private String email;
           private String phone;
           private String fax;
           private String password;
           private String passwordCheck;
    /* forward name="success" path="" */
    private final static String SUCCESS = "success";
    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        response.sendRedirect("complete.jsp");
        return mapping.findForward(getSUCCESS());
    public String getFirstName() {
        return firstName;
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    public String getLastName() {
        return lastName;
    public void setLastName(String lastName) {
        this.lastName = lastName;
    public String getUserName() {
        return userName;
    public void setUserName(String userName) {
        this.userName = userName;
    public String getEmail() {
        return email;
    public void setEmail(String email) {
        this.email = email;
    public String getPhone() {
        return phone;
    public void setPhone(String phone) {
        this.phone = phone;
    public String getFax() {
        return fax;
    public void setFax(String fax) {
        this.fax = fax;
    public String getPassword() {
        return password;
    public void setPassword(String password) {
        this.password = password;
    public String getPasswordCheck() {
        return passwordCheck;
    public void setPasswordCheck(String passwordCheck) {
        this.passwordCheck = passwordCheck;
    public static String getSUCCESS() {
        return SUCCESS;
    private javax.sql.DataSource getHima() throws javax.naming.NamingException {
        javax.naming.Context c = new javax.naming.InitialContext();
        return (javax.sql.DataSource) c.lookup("java:comp/env/jdbc/hima");
my complete.jsp where insertion happens
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ page import="java.sql.*" %>
String firstName=("firstName");
String lastName = getInitParameter("lastName");
String userName = getInitParameter("userName");
String email= getInitParameter("email");
String phone = getInitParameter("phone");
String fax = getInitParameter("fax");
String password = getInitParameter("password");
String passwordCheck = getInitParameter("passwordCheck");
<%
       String firstName=(String)request.getAttribute("firstName");
       request.getSession().setAttribute("firstName",firstName);
%>  
<sql:query var="queryresults" dataSource="jdbc/hima">
        select phone from user
        </sql:query>
<sql:update var="resultset" dataSource="jdbc/hima">
            INSERT INTO user1 (firstName,lastName,userName,email,phone,fax,password,passwordCheck)
            VALUES(firstName,lastName,userName,email,phone,fax,password,passwordCheck)
        </sql:update>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
<form action="comp"></form>
    <h1>JSP Page</h1>
    <table>
    <tr>
    <th>first</th>
    </tr>
    <c:forEach var="row" items="${queryresults.rows}">
        <tr>
        <td><c:out value="${row.phone}"/></td>
        </tr>
    </c:forEach>
</table>
    </body>
</html>

Similar Messages

  • XML document convert into String and Insert into Database

    Hello all,
         In the FIle to File Scenario  I want to send the data to the Reciever System in xml Document and convert into String and insert into Database.
      Please can you tell me exact way how to send it.
    Thanks & Regards,
    Raj

    HI,
    As per my understanding your scenario is File to file where you will get output fiel in XML format.
    Now that XMl payload need to be passed as single string in the database via XI.
    You cauld do this but you need to imply some manipulations such as
    With the help of standard API you need to concatenate the  XML tags and create the structre along with the data.
    For e.g. in your outpuf file the XML structre contain data as
    <field1>ABCD</field1>
    Then in mapping
    The source field will be mappeda s concat(<field1>) + value of  Source field "ABCD" + concat(</field1>) to the target field.
    This is the way that you could achive the requirments else there is no direct way avaialble for it.
    thanks
    Swarup

  • Pool data from text file and insert into database

    Can anyone tell me how to pool data from a text file and insert into database?
    let's say my text file is in this format
    123456 Peter 22
    234567 Nicholas 24
    345678 Jane 20
    Then I need to insert the all the value for this three column into a table which has the three column name ID, Name, Age
    Anyone knows? I need to do this urgently...Thank in advanced

    1. Use BufferedReader and read the file line by line.
    2. Loop thru the file and do the following steps with in this loop.
    3. Use StringTokenizer to seperate each line into three values (columns).
    4. Now create a insert statement with these values and add the statement to the batch (using addBatch() method of PreparedStatement or Statement).
    5. Finally (after exiting the loop), execute these batch of statements (using ps.executeBatch()).
    Sudha

  • Date not changing based on timezone during insert into database...

    I have a bpel project that gets data in GMT and insert into a database that's based on EST timezone...for some reason during insert into database, I expect it to reflect the time in EST time, but it's not doing so. It's a standard oracle bpel project and there was no customization to the date input. The following are the details:
    input data:
    <InvoiceDate>
    <GLogDate>20110613213249</GLogDate>
    <TZId>UTC</TZId>
    <TZOffset>+00:00</TZOffset>
    </InvoiceDate>
    date I get after transformation:
    <ns5:invoiceDate> 2011-06-13T21:32:49 </ns5:invoiceDate>
    date that gets inserted into the database:
    6/13/2011 9:32:49 PM
    Any thoughts as to what's going on? Is this the intended fuctionality or how does it adjust itself to the daylight saving? I thought database itself would handle it in this case.
    Thanks,
    Amkay

    WpgMom --
    From your description, it sounds totally like you are using Manually Scheduled tasks, which is not what you should be using in your project.  If you look at the Gantt bars in the Gantt Chart view of your project, if the Gantt bars are a turquoise color,
    you are using Manually Scheduled tasks, and that would be the reason that the dates do not automatically calculate for you.  If this is the case, click the Select All button to select every task in the project.  In the Tasks section of your Task
    ribbon, click the Auto Schedule button.  From this point forward, your project schedule will automatically recalculate every time you make any kind of schedule edit.
    Also, in the lower left corner of the Microsoft Project application window, you will probably see a button that says New Tasks: Manually Scheduled.  Click this button and select the Auto Scheduled option.
    To avoid all of these problems in all future projects, click File > Options.  In the Project Options dialog, click the Schedule tab.  In the Scheduling Options for This Project section, click the pick list where you see the name of your project
    and select the All New Projects item on the pick list.  Click the New Tasks Created pick list and select the Auto Scheduled option.  Click the OK button.
    Hope this helps.
    Dale A. Howard [MVP]

  • Error inserting into database

    need help,am tryin to insert data into my database which contains date,
    names,phone,address and deposit and it's giving this error message:
    java.lang.ClassCastException:java.util.Date cannot be cast to java.sql.Date.
    somebody help me please.thanks in advance.
    code:
    '\n'
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    import java.text.*;
    public class NewCustomerRecord extends JFrame{
         private JTextField firstnameF,othernameF,phoneF,addressF,depositF,currentF,dateF;
         private JButton registerbutton;
         private Connection con;
         private Statement st;
         private ResultSet set;
         private PreparedStatement stat;
         public NewCustomerRecord(){
              //super(f,"",true);
              JPanel panel = new JPanel();
              panel.setLayout(null);
              JLabel firstL = new JLabel("First Name:");
              firstL.setBounds(5,15,80,20);
              panel.add(firstL);
              firstnameF = new JTextField();
              firstnameF.setBounds(70,15,100,20);
              panel.add(firstnameF);
              JLabel otherL = new JLabel("Other Names:");
              otherL.setBounds(175,15,80,20);
              panel.add(otherL);
              othernameF = new JTextField();
              othernameF.setBounds(255,15,100,20);
              panel.add(othernameF);
              JLabel phoneL = new JLabel("Phone No.:");
              phoneL.setBounds(5,40,80,20);
              panel.add(phoneL);
              phoneF = new JTextField();
              phoneF.setBounds(70,40,100,20);
              panel.add(phoneF);
              JLabel addressL = new JLabel("Address:");
              addressL.setBounds(185,40,80,20);
              panel.add(addressL);
              addressF = new JTextField();
              addressF.setBounds(255,40,100,20);
              panel.add(addressF);
              JLabel depositL = new JLabel("Deposit:");
              depositL.setBounds(5,65,60,20);
              panel.add(depositL);
              depositF = new JTextField();
              depositF.setBounds(70,65,100,20);
              panel.add(depositF);
              /*JLabel currentL = new JLabel("Current Bill:");
              currentL.setBounds(135,65,80,20);
              panel.add(currentL);
              currentF = new JTextField();
              currentF.setBounds(205,65,50,20);
              panel.add(currentF);*/
              JLabel dateL = new JLabel("Date:");
              dateL.setBounds(185,65,50,20);
              panel.add(dateL);
              dateF = new JTextField();
              dateF.setBounds(255,65,100,20);
              panel.add(dateF);
              registerbutton = new JButton("Register Customer");
              registerbutton.setBounds(115,100,145,20);
              registerbutton.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                        insertRecord();
                        dispose();
              registerbutton.setMinimumSize(new Dimension(50,20));
              panel.add(registerbutton);
              add(panel);
              setSize(400,200);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public void insertRecord(){
              double bal=0.0;
              String s=depositF.getText();
              double dep = Double.parseDouble(s);
              bal+=dep;
              //String ss=dateF.getText();
              //short dd=Short.parseShort(ss);
              String ss=Double.toString(dep);
              String bb=Double.toString(bal);
              String fullName=firstnameF.getText()+"\t"+othernameF.getText();
              try{
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con=DriverManager.getConnection("jdbc:odbc:sparkletransaction","","");
                   SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yy");  //added
                   Date d = (Date)sdf.parse(dateF.getText());
                   //java.sql.Date date = new java.sql.Date();
                   //date.setTime(d.getTime());
                   String insert="INSERT INTO personaltransaction(date,name,phone,addres,deposit,balance) VALUES(?,?,?,?,?,?)";
                   //insert=insert+;
                   stat=con.prepareStatement(insert);
                   stat.setDate(1,d);
                   stat.setString(2,fullName);
                   stat.setString(3,phoneF.getText());
                   stat.setString(4,addressF.getText());
                   stat.setString(5,ss);
                   stat.setString(6,bb);
                   stat.executeUpdate();
                   stat.close();
              catch(Exception e){
                   System.out.println(e);
         public static void main(String[] arg){
              new NewCustomerRecord().setVisible(true);
    }

    java.lang.ClassCastException:java.util.Date cannot be
    cast to java.sql.Date.
    Hint:
    public static java.sql.Date convert2SqlDate(java.util.Date date) {
        return new java.sql.Date(date.getTime());
    }

  • FRM-40602: Cannot insert into or update data in a view

    Hi all!
    I have a form based on a view and I want to get rid off this message.
    I set the properties blocks query only but it still doesn't work.
    Does someone met with this situation?
    Many thanks!

    Hello
    I've just been messing about with a similar problem. Basically, I have a view that involves a join across two tables, I have a data block in my form that's based on the view, and I've written an INSTEAD OF trigger to insert/update/delete from the two tables.
    I was getting the error message 'Cannot insert or update data in a view', and it turned out that the error was happening because the join column between the two tables was the primary key on one of the tables, but the corresponding column on the join table had no unique key on it. This meant that Oracle couldn't establish a one-to-one relationship between rows in the view and rows in the underlying tables. The column on the join table was in fact unique on that table, and adding a unique constraint on that column in the database cured the problem.
    Hope that's of use.
    regards
    Andrew
    UK

  • Error while insert into database using DB adpater for Field BLOB

    Hello All
    I am trying to tranfer data from Database A to Database B using Oracle DB adapter.
    Table of databse A contains field BLOB, which cotains the resume /doc file.After transformation in Database B format ,while invoking the DB adapter to insert, I am getting follwing error
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="code"><code>null</code>
    </part><part name="summary"><summary>file:/u01/bpelvinc/product/10.1.3.1/OracleAS_1/bpel/domains/viapps/tmp/.bpel_ERecuit_Application_New_1.0_d1c2b2149a9e0c7c745279667ad1fc84.tmp/DB_APPL_111.wsdl [ DB_APPL_111_ptt::insert(RtmApplicantCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [DBAPPL111.RtmApplicant]. [Caused by: Error in encoded stream, got 2]
    ; nested exception is:
         ORABPEL-11616
    DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [DBAPPL111.RtmApplicant]. [Caused by: Error in encoded stream, got 2]
    Caused by Exception [TOPLINK-3001] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [xs:base64Binary 43524541544520544193B0D0A], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
    Internal Exception: java.io.IOException: Error in encoded stream, got 2.
    </summary>
    </part><part name="detail"><detail>
    Exception Description: The object [xs:base64Binary 4352E616D65293B0D0A], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
    Internal Exception: java.io.IOException: Error in encoded stream, got 2</detail>
    </part></bindingFault>
    Please let me know ,what are the possibilities.
    Thanks
    Satendra

    Hi...
    well... My flow goes like Pl/SQl ---> BPEL,
    Now PL/SQL code reads data from the Database A and Send it to BPEL which inserts into the Database B.
    with respest to above design, I found the problem in pl/sql block.
    Actually I am sending a BLOB field in the soap message. but some how pl/sql now ablt tot handle that or sending some wrong data.
    my question is how to send a blob filed data to bpel using pl/sql block. this the reasion I am getting above error.
    Thanks

  • Date Format in servlet when i insert into database

    I am inserting data into database through servlet, but i am getting NumberFormat Exception, and my datatype in database is DATE ,when i typecast my day and year because they r in int and changing into String,still i am getting the same error .So please can any one tell me where to cahnge the format of date and how to type cast to my Date format of database.
    Thanks,
    lalitha

    My code is:import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.text.*;
    import java.sql.Date;
    import java.util.*;
    public class RegisterServlet extends HttpServlet
         Connection con;
         PreparedStatement ps;
    public void init(ServletConfig sc) throws ServletException
         try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con=DriverManager.getConnection("jdbc:odbc:plk","scott","tiger");
         System.out.println("connection created");
         catch(Exception e)
         System.out.println(e);
    public void doPost(HttpServletRequest req, HttpServletResponse res)
         try
         res.setContentType("text/html");
         PrintWriter pw= res.getWriter();
    String ulogin=req.getParameter("login").trim();
    String uph1=req.getParameter("ph1").trim();
    int ph1=Integer.parseInt(uph1);
    String upass=req.getParameter("pass").trim();
    String uph2=req.getParameter("ph2").trim();
    int ph2=Integer.parseInt(uph2);
    String cpass=req.getParameter("cfm").trim();
    String uweb=req.getParameter("web").trim();
    String ufirst=req.getParameter("first").trim();
    String uaddress=req.getParameter("address").trim();
    String umiddle=req.getParameter("middle").trim();
    String ucity=req.getParameter("city").trim();
    String ulast=req.getParameter("last").trim();
    String uzip=req.getParameter("zip").trim();
    int zip=Integer.parseInt(uzip);
    String ud=req.getParameter("Aday").trim();
    String um=req.getParameter("Amonth").trim();
    String uy=req.getParameter("Ayear").trim();
    SimpleDateFormat din=new SimpleDateFormat("dd-mm-yyyy");
    SimpleDateFormat dout=new SimpleDateFormat("yyyy/mm/dd");
    String txtDate="2001-07-07";
    Date date=din.parse(txtDate);
    java.sql.Date dt=new java.sql.Date(txtDate);
    dout.format(dt);
    String usex=req.getParameter("sex").trim();
    String uemail=req.getParameter("email").trim();
    String ust=req.getParameter("st").trim();
    String ucty=req.getParameter("cty").trim();
    ps=con.prepareStatement("insert into Userdetails values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    ps.setString(1,ulogin);
    ps.setString(2,uph1);
    ps.setString(3,upass);
    ps.setString(4,uph2);
    ps.setString(5,cpass);
    ps.setString(6,uweb);
    ps.setString(7,ufirst);
    ps.setString(8,uaddress);
    ps.setString(9,umiddle);
    ps.setString(10,ucity);
    ps.setString(11,ulast);
    ps.setString(12,uzip);
    ps.setDate(13,dt);
    ps.setString(14,usex);
    ps.setString(15,uemail);
    ps.setString(16,ust);
    ps.setString(17,ucty);
    int i=ps.executeUpdate();
    if(i==1)
    pw.println("<h3><center> Thankyou! Your details have been stored. </center></h3>");
    res.sendRedirect("http://localhost:8080/SeekLogin.html");
    pw.close();
    else
         pw.println("<h3><center>Sorry! you are not registered properly. </center></h3>");
    pw.close();
    catch(Exception e)
         System.out.println(e);
    Can anyone look this code and help me out where i am doing the mistake.
    Thanks.

  • Trigger a process when a record is inserted into database

    Hi, could someone tell me how to do the following (if it's possible):
    when a record is inserted into a table in a database,
    I want it to somehow trigger an action which will put an item into user's To-Do inBox of the WorkSpace,
    the user can then open the form in the To-Do and use it to view the data in the newly inserted record.
    this "user"'s login ID is part of the inserted record.
    thanks

    Mmm, trigger?  I don't know of a way.
    But I supposed you could have a process that has a timer that peroidically queries the database for changes and then do the same thing.
    You could also perhaps write a Service and then use the Java API to start a process?
    Maybe take a look here
    http://blogs.adobe.com/livecycle/2010/12/how-to-invoke-a-livecycle-process-periodically.ht ml

  • Insert into database table

    Hi Guy's,
    Please help me, trying to insert the records into database table. when i debug the program work area contain  data records  but not insert into databse table.  Here pasted my code pls suggest me where i did mistake.
    FUNCTION ZEXM_PHOTOCOPYDTLS_EP.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(EXMCODE) TYPE  ZEXMCODE OPTIONAL
    *"     VALUE(EXMMONTH) TYPE  ZEXMMONTH OPTIONAL
    *"     VALUE(SEATNO) TYPE  ZSEATNO OPTIONAL
    *"     VALUE(STDFIRSTNAME) TYPE  ZSTDFIRSTNAME OPTIONAL
    *"     VALUE(STDMIDDLENAME) TYPE  ZSTDMIDDLENAME OPTIONAL
    *"     VALUE(STDLASTNAME) TYPE  ZSTDLASTNAME OPTIONAL
    *"     VALUE(ADDLINE1) TYPE  ZADDLINE1 OPTIONAL
    *"     VALUE(CITY) TYPE  ZCITY OPTIONAL
    *"     VALUE(COUNTRY) TYPE  ZCOUNTRY OPTIONAL
    *"     VALUE(PIN) TYPE  ZPIN OPTIONAL
    *"     VALUE(TELEPHONENO) TYPE  ZTELEPHONENO OPTIONAL
    *"     VALUE(MOBNO) TYPE  ZMOBNO OPTIONAL
    *"     VALUE(EMAIL) TYPE  ZEMAIL OPTIONAL
    *"     VALUE(DDNO) TYPE  ZDDNO OPTIONAL
    *"     VALUE(DDAMT) TYPE  ZDDAMOUNT OPTIONAL
    *"     VALUE(DDDATE) TYPE  ZDDDATE OPTIONAL
    *"     VALUE(BANKNAME) TYPE  ZBANKNAME OPTIONAL
    *"     VALUE(COLNAME) TYPE  ZCOLNAME OPTIONAL
    *"     VALUE(COLADDRESS) TYPE  ZCOLADDRESS OPTIONAL
    *"     VALUE(COURSECODE) TYPE  ZCOURSECODE OPTIONAL
    *"     VALUE(EXMYEAR) TYPE  ZEXMYEAR OPTIONAL
    *"     VALUE(PAPERCODE) TYPE  ZPAPERCODE OPTIONAL
    *"     VALUE(PAPERNO) TYPE  ZPAPERNO OPTIONAL
    *"     VALUE(MARKSOBT) TYPE  ZMARKSOBT OPTIONAL
    *"     VALUE(EXMDATE) TYPE  ZEXMDATE OPTIONAL
    *"     VALUE(EXMTIME) TYPE  ZEXMTIME OPTIONAL
    *"     VALUE(SUBCODE) TYPE  ZSUBCODE OPTIONAL
    *"  EXCEPTIONS
    *"      SELECTION_ERROR
      DATA : WA_OUTPUT TYPE  ZEXM_PHOTOCOPYDT,
             WA_COLL TYPE ZEXM_COLLEGEMST,
             WA_COURSE TYPE ZEXM_COURSEMST,
             WA_EXMCODE TYPE ZEXM_EXMCODEMST,
             WA_PAPER   TYPE ZEXM_PHOPAPERMAP,
             WA_SUBJECT TYPE  ZEXM_SUBJECTMST.
    STUDENT DETAILS
      MOVE : EXMCODE     TO WA_OUTPUT-ZEXMCODE,
             EXMMONTH    TO WA_OUTPUT-ZEXMMONTH,
             SEATNO    TO WA_OUTPUT-ZSEATNO,
             STDFIRSTNAME TO WA_OUTPUT-ZSTDFIRSTNAME,
             STDMIDDLENAME TO WA_OUTPUT-ZSTDMIDDLENAME,
             STDLASTNAME TO WA_OUTPUT-ZSTDLASTNAME,
             ADDLINE1    TO WA_OUTPUT-ZADDLINE1,
             CITY        TO WA_OUTPUT-ZCITY,
             COUNTRY     TO WA_OUTPUT-ZCOUNTRY,
             PIN         TO WA_OUTPUT-ZPIN,
             TELEPHONENO TO WA_OUTPUT-ZTELEPHONENO,
             MOBNO       TO WA_OUTPUT-ZMOBNO,
             EMAIL       TO WA_OUTPUT-ZEMAIL,
             DDNO        TO WA_OUTPUT-ZDDNO,
             DDAMT       TO WA_OUTPUT-ZDDAMT,
             DDDATE      TO WA_OUTPUT-ZDDDATE,
             BANKNAME    TO WA_OUTPUT-ZBANKNAME.
    insert into ZEXM_PHOTOCOPYDT values wa_output.
    if sy-subrc = 0.
    commit work.
    endif.
    Thanks and Regards,
    Sai.
    Edited by: sai shanhu on Jun 4, 2008 11:13 AM

    Hai,
    move wa_output into ZEXM_PHOTOCOPYDT.
    insert  ZEXM_PHOTOCOPYDT.
    Thanks,
    Durai.V

  • How to insert into database using jsp

    sir
    the code below is to enter the items in the database but it is giving the error .......of null.................
    <!-- JAI SHRI RAM -->
    <%@ page import="java.sql.*" %>
    <html>
    <head><title>JAI SHRI RAM</title></head>
    <body>
    <%
    String url = "jdbc:odbc:lala" ;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(url,"","");
    Statement st = conn.createStatement();
    for(int i=1 ; i<=13 ; i++)
    String skill_type = request.getParameter("skill_type"+i);
    String skill_name = request.getParameter("skill_name"+i);
    String version = request.getParameter("version"+i);
    String lastused = request.getParameter("last_used"+i);
    int last_used = Integer.parseInt(lastused);
    String proficiency_level = request.getParameter("proficiency_level"+i);
    String expinyears = request.getParameter("exp_in_years"+i);
    int exp_in_years = Integer.parseInt(expinyears);
    String expinmonths = request.getParameter("exp_in_months"+i);
    int exp_in_months = Integer.parseInt(expinmonths);
    String query = "insert into skills values(1 , '" + skill_type + "' , '" + skill_name + "', '" + version + "', 1 , '" + proficiency_level + "', 1 ,1)";
    st.executeUpdate(query);
    out.println("JAI SHRI RAM ,,,,,,,, transcation is over");
    %>
    </body>
    </html>
    i m using MS ACCESS
    please tell me the problem
    thank you
    gaurav

    Hi,
    Most probably you have problem in proper initialization of the database driver or the connection url.
    In lines shown bellow
    String url = "jdbc:odbc:lala" ;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(url,"","");Try to do that with more simple operations e.g. insert in a table with one field.

  • Parse xml data and insert into database

    Hi Friends,
    I have an xml document which needs to be parsed and the data need to be inserted into an oracle database table.
    Please tell me which will be the easiest and optimal way of doing this.
    Thanks,
    Achayan

    Take a look at the JDOM xml parsing library - google for JDOM download or something.
    This will allow you to build an object representation of the XML doc, from which you can then extract the data.
    J

  • JSP cannot Insert into MYSQL

    hi, i have a jsp code which can successfully return results from MySQL database. But once i change the SQL statement from a select statement to a insert statement, it does not add in a new row in the database. It has no error while compiling but it also appear nothing on the screen when being run. Has the problem got to do with the user privilages of MySQL? thanks.
    //jsp file which parameter posted from another html file. Parameter has been successfully passed.
    <%@ page import="java.sql.*"%>
    <body>
    <%
         String file = request.getParameter("file");
         String pic = request.getParameter("pic");
         ResultSet rs = null;
         ResultSet rs2 = null;
         String timestamp = "CURRENT_TIMESTAMP()";
         String q2 = "Select * from fileReqAce";
         String q1 = "INSERT INTO fileReqAce(PIC,FileName,DateReq) VALUES('"+pic+"','"+file+"',CURRENT_Timestamp())";
    try{
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/wendy?user=user;password=password");
    Statement state = con.createStatement();
         %><br><%
         rs = state.executeQuery(q1);
         //Statement state2 = con.createStatement();
         /**rs2 = state2.executeQuery(q2);
         %><br>
         <table border="1"><%
         while(rs2.next()){
         %>
         <tr>
         <td>Request by : <%=rs2.getString("PIC")%></td><td>File Reference : <%=rs2.getString("FileName")%></td><td>Time Requested : <%=rs2.getTimestamp("DateReq")%></td>
         </tr>
         <%
         %></table>
    <%**/
         rs.close();
    //     rs2.close();
         con.close();
         catch(Exception e)
         System.err.println("Unable to load driver");
         e.printStackTrace();
    %>
    </body>

    That all might be good and well but I think the very important thing to note here is what the first reply stated.
    If you are going to run an Insert sql statement you need to use the executeUpdate() method. You also use this function for Updates and Delete SQL statements.
    Only Select statements that return a recordset use the executeQuery() method. The executeUpdate() method returns an interger that reflects the number of rows affected by the SQL statement.
    Like when you insert 1 row the return value of the executeUpdate method will be one. You can accordingly check this returned value to see if the operation ran successfully. A return value of 0 means that now rows where inserted.
    That is my 2c worth. I hope it helped some.

  • Can select, but cannot insert into oracle tables using php.

    I am having trouble inserting data into a tables in oracle using PHP. I can insert into the tables using baninst1, but nothing else. I can't even insert using the tables' owner. Every time I try I get the ORA-00492 error of table or view does not exist. However, I can run a select statement just fine. So far, baninst1 is the only user that can actually do inserts. I've triple checked all the table grants and everything is fine. Also, I can copy/paste the exact insert statement into SQL*Plus and it works with the correct user. It doesn't have to be baninst1. I've tried everything I can think of. I've tried putting the table name in quotes, adding the schema name to the table, checking public synonyms, but everything appears to be ok. I would greatly appreciate any suggestions others may have.
    I'm using PHP 5.2.3 with an oracle 9i DB.

    Here is the code that doesn't work. It works only with baninst1, no other username will work and all I do is change the my_username/my_password to something different. This is one example function where I try to do an insert, but it doesn't work on any of the tables I try.
    Thanks for looking.
    class Oracle {
         private $oracleUser = "my_username";
         private $oraclePassword = "my_password";
         private $oracleDB = "MY_DB";
         private $c = null;
         function Connect() {
              if ( !($this->c = ocilogon( $this->oracleUser, $this->oraclePassword, $this->oracleDB ) ) )
                   return false;
              return true;
         function AddNewTest($testName, $course, $section, $term, $maxAttempts, $length, $startDate, $startTime, $endDate, $endTime)
              $result = "";
              if( $this->c == null )
                   $this->Connect();     
              $splitIndex = strpos($course, " ");
              $subjectCode = substr($course, 0, $splitIndex);
              $courseNumber = substr($course, $splitIndex + 1);
              $insertStatment = "insert into szbtestinfo(szbtestinfo_test_name,
                                                                szbtestinfo_course_numb,
                                                           szbtestinfo_section,
                                                                szbtestinfo_max_attempts,
                                                                szbtestinfo_length_minutes,
                                                                szbtestinfo_start,
                                                                szbtestinfo_end,
                                                                szbtestinfo_id,
                                                                szbtestinfo_subj_code,
                                                                szbtestinfo_eff_term)
                                                                values( '" . $testName .
                   "', '" . $courseNumber .
                   "', '" . $section .
                   "', " . $maxAttempts .
                   ", " . $length .
                   ", to_date('" . $startDate . " " . $startTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", to_date('" . $endDate . " " . $endTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", szsnexttest.nextval" .
                   ", '" . $subjectCode .
                   "', '" . $term . "')";
              //return $insertStatment;
              $s = OCIParse($this->c, $insertStatment);
              try
                   $result = OCIExecute($s);
              catch(exception $e)
              return $result;
         }

  • Import parametes and insert into database table suggestions

    experts need suggestions
    created a table with 3 fields.
    zstable.
    field dataelement type length
    kunnr  kunnr      char  10       key field
    name   dname      char   30      key field
    aedat aedat        dats  8
    aenam  aenam       char  12
    now i am creating a function modlue with two input parameters
    1)kunnr
    2)name
    i want to update this two fields into table zstable.
    1. so suggest me the best way to do this.
    Delcarations in import options which one of the below is best and why?
    name type char30
    kunnr type kunnr
    or
    name like zstable-name
    kunnr like zstable-kunnr
    or
    kunnr type zstable-kunnr
    name type zstable-name.
    2. inserting into table
    the data that we recieve from the import parameters need to be inserted into the zstable.
    please suggest me the appropriate statement  waht i need to code for this.
    insert kunnr name into zstable.
    can i ignore the third field as it is not the key field?
    3. before inserting do i need to check whether kunnr and uname is initial ie import parametrs?
    4. suppose if i delcared two input parameters  in function module zfuntion say vbeln and posnr.
      and source code
    insert vbeln and posnr into zstable.
    now i am calling from the program
    zreport.
    call function 'ZFUNCTION'.
    EXPORT
    NAME =
    KUNNR =
    Will the above statement updates the blank records into the table zstable?.

    Hi,
    1) I think the best is either refer directly to data element or to table field. This is beacuse once any change is made to this data element it will automatically reflect in your parameters. For table fields it is a bit less safier but still correct. Golden rule - always try to refer to DDIC components like data elements.
    name type dname
    kunnr type kunnr
    2) You need to provide all key fields. I recommend to use MODIFY as it would hanlde both INSERT (if yet no such record exists ) and UPDATE (if already exists).
    data: wa_zstable type zstable. "declare work area
    wa_zstable-kunnr = kunnr.  "pass parameters here
    wa_zstable-name = name.
    modify zstable from wa_zstable.
    3) good practise, for this use
    if kunnr is initial and  
       name is initial.
      "modify ...
    endif.
    "or if parameters are set as OPTIONAL, then use
    if kunnr is supplied and
       name is supplied.
    endif.
    4) No, the statment you want to use
    insert vbeln and posnr into zstable.
    is only used for FIELD GROUPS, not DB table. Please refer [INSERT|http://help.sap.com/abapdocu/en/ABAPINSERT_DBTAB_SHORTREF.htm] for correct syntax.
    You can alternatively use somthing like
    UPDATE zstable SET vbeln = ...
                                            posnr = ...
                                     WHERE ...
    This will update fields VBELN and PONR for all records fullfilling WHERE condition. These however musn't be key fields, only non-key fields can be udpated.
    Regards
    Marcin

Maybe you are looking for

  • Cannot Access Routers Web Based Page?

    I have a wireless Linksys router Model WRT54G and it will not let me access my routers web based page. When I enter the default IP address into the Address Bar nothing happens (I've checked to make sure my router is on the default IP), i just get a b

  • After I've closed Firefox and try to re-open it, it'll say it's already running. Have had to re-boot my computer several times a day to get it running again. HELP!!!!

    This is a problem that I've been experiencing for the last month. After I've had Firefox open and then close it, when I try to re-open it, it says it's already running, but I have to re-boot my computer to get it going again. I have had to re-boot 5

  • PO update for SES and ME2N

    I have following situation: PO created for $5000 for service- SES created for 1070, MIRO created and paid for 1070 ( $ 70 is or tax) PO history tab shows SES for $1070: GR for $1070 and IR for $1070 However, when I go into ME2N it shows Still to be d

  • Software issue elements 8.0

    I have Photoshop Elements 8.0 and have enjoyed using it and it has worked great for 2 years. Recently part of the program does not work correctly. When I use the Adjust color for skin tone it will show the same skin and ambient light adjustment bars

  • "N/A" representation of a NULL field

    Hello... In one of our forte applications we have a rule entry / QBE type of window. On this screen the null columns represent "don't cares". For this window we would like to replace the standard "N/A" with '*' or blank. Is there a way we could chang