Database not getting updated

package com.sandy.servlets;
import javax.servlet.*;
import java.sql.*;
import javax.servlet.http.*;
import java.io.*;
public class FirstServlet extends HttpServlet
     Connection con;
     PreparedStatement ps;
     public void init(ServletConfig config) throws ServletException
     String driver=config.getInitParameter("driver");
     String cs = config.getInitParameter("url");
     String user=config.getInitParameter("user");
     String password=config.getInitParameter("pwd");
     try
          Class.forName(driver);
          con=DriverManager.getConnection(cs,user,password);
          ps=con.prepareStatement("INSERT INTO USER2 VALUES(?,?)");
     catch (ClassNotFoundException e)
          e.printStackTrace();
catch(SQLException e)
e.printStackTrace();
}//init()
public void destroy()
try
     if(ps!=null)
          ps.close();
     if(con!=null)
          con.close();
catch (SQLException e)
     e.printStackTrace();
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
String a = request.getParameter("FirstName");
String b = request.getParameter("LastName");
try
   if(a!=null)
        if(b!=null)
     ps.setString(1,a);
     ps.setString(2,b);
     ps.executeUpdate();
catch (SQLException e)
     e.printStackTrace();
response.sendRedirect("user.html");
I ran the above program in tomcat,i didn't get any error but unfortunately database is not getting updated which is the sole purpose of this application
Edited by: sandy on Feb 8, 2011 12:33 AM

do you have some kind of auto commit? I don't see you commit the transaction anywhere.
By the way: this is terrible design. Perhaps you can open a connection on servlet init (still not a good design, but you seem to be in the learning phase so lets not focus on that now), but you should create the PreparedStatement, use it, commit it and then close it inside your doPost() method.

Similar Messages

  • File to JDBC -  JDBC database not getting updated using UPDATE_INSERT

    Hi ,
        I have a done a file to JDBC Scenario.File is successfully picked up by sender file channel and recieved by reciever JDBC channel.There is no error in receiver communication channel.I used UPDATE_INSERT action in mapping which has to update the database with all records it recieve.But,i found there is no update in Database table.I donot have access to database,so i made a sender jdbc channel querying all data in it to see what new value is populated.
    I made a dummy sender jdbc channel to check what are the values updates on the run of above interface.But , i found no update occur.Please help me out of this problem.
    Thanks
    Deepak Jaiswal

    The reason I ask , because you will see whether the message got successfully delivered to the target system.
    I want  to see information like below
    2010-04-14 14:31:35 Success Message successfully received by messaging system. Profile: XI URL: http://server:port/MessagingSystem/receive/AFW/XI Credential (User): PIISUSER
    2010-04-14 14:31:35 Success Using connection JDBC_http://sap.com/xi/XI/System. Trying to put the message into the receive queue.
    2010-04-14 14:31:35 Success Message successfully put into the queue.
    2010-04-14 14:31:35 Success The message was successfully retrieved from the receive queue.
    2010-04-14 14:31:35 Success The message status set to DLNG.
    2010-04-14 14:31:35 Success Delivering to channel: Communuication channel
    2010-04-14 14:31:35 Success MP: Entering module processor
    2010-04-14 14:31:35 Success MP: Processing local module localejbs/CallSapAdapter
    2010-04-14 14:31:35 Success Receiver JDBC adapter: processing started; QoS required: ExactlyOnce
    2010-04-14 14:31:35 Success JDBC adapter receiver channel CC: processing started; party  , service DB_BS
    2010-04-14 14:31:35 Success Database request processed successfully
    2010-04-14 14:31:35 Success MP: Leaving module processor
    2010-04-14 14:31:35 Success The message was successfully delivered to the application using connection JDBC_http://sap.com/xi/XI/System.
    2010-04-14 14:31:35 Success The message status set to DLVD.
    raj.

  • APEX-The manullay created column is not getting updated in the database

    Dear all
    I have a form on page, which is created along with a report using Form on a Table with Report option. From the form I have deleted one field and recreated manullay as set the property as database column. When I am calling from the report page (using defualt edit option) the value is showing there, but if I am 'Apply Changes' , the column value in database is get updated with null.
    Please help
    DJ.

    This is the SQL and PL/SQL forum.
    Please re-post this on the APEX forum.
    Oracle Application Express (APEX)

  • Values not getting updated in table mvke

    Hi,
    I am working on a module pool program.In the o/p screen there are many records.If the user wants to change the field values of a particular record,he clicks on the checkbox besides that record and when he click on the change button,control goes to update screen.In this screen when the user changes the value of one particular field and click on the checkbox beside and then click on the execute button,the changed value of that field should get updated in that particular record in the database table.Here I want to update mvke and marc tables.
    I have used FM BAPI_MATERIAL_SAVEDATA to update the database tables.
    Only marc table is getting updated with changed values.mvke table is not getting updated.What would be the reason for this.
    I am sending a part of my code.Please check it.
    form move_mat_data .
    *Header
    gt_bapi_head-material = gs_output1-matnr.
    gt_bapi_head-ind_sector = gs_output1-mbrsh.
    gt_bapi_head-matl_type = gs_output1-mtart.
    gt_bapi_head-basic_view = 'X'.
    gt_bapi_head-purchase_view = 'X'.
    gt_bapi_head-account_view = 'X'.
    gt_bapi_head-sales_view = 'X'.
    *Client
    gt_bapi_client-matl_group = gs_output1-matkl.
    gt_bapi_client-base_uom = gs_output1-meins.
    gt_bapi_clientx-matl_group = 'X'.
    gt_bapi_clientx-base_uom = 'X'.
    *Plant
    gt_bapi_marc1-plant = gs_output1-werks.
    gt_bapi_marc1-pur_status = gs_output1-mmsta.
    gt_bapi_marc1-mrp_type = gs_output1-dismm.
    gt_bapi_marc1-mrp_ctrler = gs_output1-dispo.
    gt_bapi_marc1-serv_level = gs_output1-zserclass.
    gt_bapi_marc1-availcheck = gs_output1-mtvfp.
    gt_bapi_marcx-plant = gs_output1-werks .
    gt_bapi_marcx-pur_status = 'X'.
    gt_bapi_marcx-mrp_type = 'X'.
    gt_bapi_marcx-mrp_ctrler = 'X'.
    gt_bapi_marcx-serv_level = 'X'.
    gt_bapi_marcx-availcheck = 'X'.
    Material Description
    REFRESH gt_materialdesc.
    gt_materialdesc-langu = gs_output1-spras.
    gt_materialdesc-matl_desc = gs_output1-maktx.
    append gt_materialdesc.
    *Sales
    gt_bapi_mvke1-sales_org = gs_output1-vkorg.
    gt_bapi_mvke1-distr_chan = gs_output1-vtweg.
    gt_bapi_mvke1-sal_status = gs_output1-vmsta.
    gt_bapi_mvke1-valid_from = gs_output1-vmstd.
    gt_bapi_mvkex-sales_org = 'X'.
    gt_bapi_mvkex-distr_chan = 'X'.
    gt_bapi_mvkex-sal_status = 'X'.
    gt_bapi_mvkex-valid_from = 'X'.
    endform. " move_mat_data

    Hello Hema,
    Find the fields which you need to populate with values:
    As an example i'm trying to update DISPO from MARC and VKORG from MVKE.
    No need to fill clientdata and clienddatax.
    * Header data
          MOVE g_wa_mat_out-s_matnr TO g_r_headdata-material.
          MOVE 'X' TO g_r_headdata-mrp_view.
    * Plant data
          MOVE g_wa_mat_out-t_werks TO: g_r_plantdata-plant,
                                        g_r_plantdatax-plant.
              MOVE g_wa_mat_out-t_dispo_new TO g_r_plantdata-mrp_ctrler.
              MOVE 'X' TO g_r_plantdatax-mrp_ctrler.
              MOVE g_wa_mat_out-t_vkorg_new TO g_r_salesdata-sales_org.
              MOVE 'X' TO g_r_salesdatax-sales_org.
    Reward If Helpful.
    Regards
    Sasidhar Reddy Matli.
    Edited by: Sasidhar Reddy Matli on Feb 7, 2008 11:49 AM

  • CPS parameters are not getting updated in SAP

    We have recently migrated our SAP and CPs servers, after that we are  facing few CPS issues  and it is affecting lot of key batch jobs. One typical example is given below.
    CPS is supposed to trigger a job  DD simulation, by copying the SOURCE_DATE_ID -1-Dec-2006  and modifies the parameters BUDAT and FAEDA_HIGH. The parameter FAEDA_HIGH is calculated as time.now()+ 5 working days as defined in the expression. When we try to run the job today with the date 24 Dec 2010, CPS has calculated the FAEDS_HIGH correctly as 2-Jan-2011. IN SAP the variant gets created but for the field FAEDA_HIGH the date value is not getting updated properly it is display some other date. (e.g)  It is showing as 4-jan-2011,  I removed the xpression and gave another date for the FAEDA_HIGH field as 10/01/2011, but in SAP it is not getting updated.
    Has anyone faced similar kind of issue. share you experience
    Regards,
    Ramprasad.

    Hi ,
    PLease find attached out XBP version
    XBP connection pool for SAP system ISU
      XMI interface version           : 2.0
    Since we have taken backup and restored the SAP Database, the CPs transport file already exists in the System.
    Basically what happens is
    So actually what is happening is, the CPS parameter FAEDS_HIGH expressions are  not used for due date calculation.. CPS just copies the source date-id to target id  and similarly for the due date based on the difference
    source_id variant date 01-12-2006   due date 02-12-2006  ( Next day)
    Target_id Variant date 25-12-2010  due date 26-12-21010  ( Next Day)
    I tried changing the Source date id from 01-12-2006 to 24-12-2010.
    Source Variant date 24-12-2010   due date 04-01-2011 ( 10 Days)
    Target Variant date 25-12-2010  due date 05-01-2011 ( 10 Days)
    Regards,
    Ram

  • Delivery document not getting updated

    Dear Experts,
    Till date our client was using VL04 for creating DA for only domestic sales, now they
    are asking to provide facility to created DA for export shipment in VL04 and we have done customization for the same.
    Now there are two separate (delivery document number)  number ranges generated for
    domestic and export sales.
    Now my problem is :  delivery document number generated for export sales is not getting
    updated in database table VTRDI 
    Have any idea ??
    Please advice
    R.Karthik
    Edited by: Karthik R on Sep 30, 2009 5:31 PM
    Edited by: Karthik R on Sep 30, 2009 6:39 PM

    Hi Lakshmipathi  ,
    Thank you so much.....for ur valuable advice !!
    I have checked the table LIKP and LIPS ...and the export delivery number is getting saved
    in these two tables...
    But my problem is with creating shipment in VT01...as delivery number generated for export is not
    getting picked in VT01 but for normal domestic orders it is getting picked.
    I could not figure out where I went wrong??
    could you please guide me on this issue.
    R.Karthik
    Edited by: Karthik R on Oct 5, 2009 8:46 AM

  • Table not getting updated

    Hi
    I'm having a problem with updating an item which is not a database item.
    I have about 8 fields , Items 1-7 belong to table A and item 8 belongs to table B
    I have block level triggers like post-insert, pre-update and pre-delete to take care of the insert, update and delete which are all working fine.
    Except when I update Item 8 ONLY , table B does not get updated and I get the message frm-40401 - No Changes To Save
    I'm not able to figure out what else is needed. Pls help.
    Thanx

    There may be a better answer, but try setting the Lock Record property to Yes on the non-base-table item.
    If that doesn't work, in the item's when-validate-item trigger, set one of the first seven items values to itself:
    :Blk.Itm1 := :Blk.Itm1;
    This will cause the record status to be CHANGED, so the record update will take place.

  • SM 13: Data not getting updated.

    Hi Basis Gurus,
    We have installed SAP IDES for ECC6.0 using Oracle Database in our Windows 2003 Server. Everything was fine till we dicovered that the materials we create are not getting updated in the Database. When I checked SM12, the lock was created and in SM13 the data is still at initial stage as follows
    810     RAJARNO     20080730     110902     MM01 @06\QUpd.record with enqueues@     Initial
    Can somebody explain why this is happening and how can i resolve the same?
    Thanks in Advance for your help.
    Regards,
    Rajesh Manoharan

    Hi Siddesh / Samrat,
    The logs are pretty low. Infact the system is 1 week old i.e. we installed it only a week back.
    I checked the SM 14 status.. it says Update is Active.
    I checked even the hard disk space and it shows 30 Gig free space..
    Please let me know anything else I need to see.
    Thanks,
    Rajesh Manoharan

  • 544 Movement ,Qty & value is not getting updated in MC.9

    Dear friends,
    MC.9 & MB5b report is showing difference in Qty & Value.In my analysis i came to know that 544 movement is not getting updated in MC.9. I also Checked the Statistically relev. key as 2 and Consumption posting   G  in OMJJ.
    I require the info about MC.9 configuration or any info related to this.

    Hi,
    Please refer SAP note 581240 for this.
    For these stocks you have three valuation types for selection:
    ' ' = no inventory valuation
    'A' valuation = without reference to sales document ('make-to-stock
    inventory')
    'M' = separate valuation with reference to the sales and distribution
    document/project
    ONLY stock/stock movements with special stock valuation 'A'
    (make-to-stock inventory) are updated in Inventory Controlling.
    Thus, if you find a document which is not updated in the info structures
    of Inventory Controlling (S031-S039) and you require this, check the
    corresponding documents in the materials management tables. You can find
    the special stock indicator and indicator of the valuation of the
    special stock, for example, in document segment table MSEG in the
    following fields:
    MSEG-SOBKZ = Special Stock Indicator
    MSEG-KZBWS = Indicator: Special Stock Valuation
    Only A type (make to stock ) are updated in the info structures.
    Hoping this helps.
    Regards,
    Rajesh.

  • Master Data is not Getting Updated Properly.

    Dear Expert,
    I am trying to pull the data by Info package but The text is not getting updated.
    The Master data object is    0BPARTNER .  To update this Master data , we ghave 2 info packages
    0BPARTNER_ATTR   and    0BPARTNER_TEXT.    But the text is not getting updated ( like the fiels E-mail address, Address 1, Address 2, Address 3, Address 4,.... Phone No,Etc.
    What could be the Reason for this and How can I solve this issue  ?
    Tahnks,
    Utpal

    Hi,
    Could you please check the data in RSA3.
    If everything is there in R/3 side.Then,please check are you giving any
    condition in the infopackage .
    Please run the infopackage without giving any condition.
    Thanks,
    Saveen Kumar

  • Tax is not getting updated in Sales Order Pricing Conditions

    Hi ,
    Tax is not getting updated in Condition of sales order when creating Sales order but when we click on update button it is calculating correctly.
    Following are the changes for in the standard Pricing:
    1) Created ZPSC condition type to calculate the sur-charge from Z-table
    2) ZPR0 Condition type to calculate the sum of PR00 and ZPSC
    So tax has to be calculated based on the ZPSC value, but it is calculating the tax based on the PR00 base price.
    We implemented the logic for updating values of  Amount and condition values for ZPSC and ZPR0 by creating custom Routine 904 in Calculation types and assigned the routine in Pricing Procedure.The correct values are coming till NET VALUE 3 but tax is calculating based on the PR00 net price.
    I debugged the code for Tax Routine the value for Net value (NETWR) is the base value price but displaying correctly in Net value screen of Conditions tab.
    Please suggest how to update the Tax values correctly without manual update.
    Thanks ,
    Rajesh Sanapala.

    Hi Lakshmi,
    I am using a TAXINN procedure.....to correct my self can u brief me abt the CIN configuration settings required from SD point of view......how many tax codes have to be maintained for capturing the BED,EDCess,SHED cess,VAT,CST and what are the condition types required for capturing the same.....
    I am using JEXQ-A/R BED ......for capturing the BED....and so on ......I feel that i have missed out on some settings ,thats why few conditions are getting captured and some are not.....It would be great if you ca nhelp me on this.
    Thanks
    Ivy

  • Data is not getting updated in CRM

    HI experts,
    I am updating the new address and postal codes in ISU.And now if I check these address for buisness partner in CRM. Its not getting updated.
    why this is happening?
    Is there any BDOC used in this case then how we can check that BDOC?
    Thanks,
    Jassi

    Hello
    I am sure that the problem occurs due to this.
    You need to know the error message. To do this:
    1) Choose any red document from transaction SMW01
    2) Click on button "Show BDoc message errors/receivers" (9th button from the left)
    3) In the opening window there is a button "Errors". There is where you can find the error message.
    I hope it helps. Please, provide points if helpful.
    Joaquin

  • Data is not getting updated in table using RFC

    Hi Experts,
    In my scenario, I am calling one RFC using RFC receiver channel. After running scenario, channel is showing status that RFC executed successfully. But when I am checking tables in R/3 system, data is not getting updated.
    Moreover , when we tried to execute the RFC manually in R/3 system, that time data uploaded into table successfully.
    Could anybody tell me what would the reason that data not uploading into table when we send it through XI.
    Regards,
    Sari

    HI Sari,
    as you have scenario with RFC receiver.. and as you mentioned that it not updating tables when run through PI but when you execute RFC manually tables got updates.. then following are the options you can check..
    -- if you check RFC communication channel and if everything ok on then.. this means that your RFC is getting triggered successfully..but as you said tables are not updated.. for this you can go to SXMB_MONI and check the log take payload after mapping.. and compare it with the input when you try to execute it manually.. I think the input when you try manually and input to RFC when you try through PI is different and that is causing the Problem.. you will be able to see the difference in input then check.. I think the problem is data and not RFC communication channel..so by using this you will come to know difference
    -- else if possible configure your ID in PI in RFC Receiver and then check and put breakpoint on ABAP side.. so that when PI will hit RFC you will get it in debug mode and able to see what is going wrong..
    Thanks,
    Bhupesh

  • The currency is not getting updated in the table VBAP

    Hi ,
    The currency is not getting updated in the table VBAP. The currency was suppossed to be copied from the header table VBAK for a Sales Order. When the user creating a Sales Order the currency WAERK is not shown in VBAP table. VBAK-WAERk is in EUR . Does anyone know why is this happenning?
    Currency is maintained in the Customer Master, Material Master and Sales Org. Any suggestions?.
    Also it is happened for only one line item in a set of line items , Other line items did display the currency field.
    The net Value has data in it .
    The system is ECC 5.0
    Regards,
    Senthil

    Dear Senthil,
    Please apply the following notes (if they apply to your support pack level) and retest:
    1460621 VBAP-WAERK is deleted after the sold-to party is changed
    1426441 VBAP-WAERK deleted for subitems
    1493998 VBAP-WAERK deleted for subitems
    This should resolve the issue. I hope this helps.
    Best regards,
    Ian Kehoe

  • Data is not getting updated in DB table

    hi all
    i am doing IDOC to jdbc scenario
    i am triggering idoc from R/3 and the data is going into DB table
    sender side:       ZVendorIdoc
    receiver side:
    DT_testVendor
      Table
        tblVendor
          action       UPDATE_INSERT
          access      1:unbounded
            cVendorName 1
            cVendorCode 1
         fromdate    1
         todate      1
          Key
            cVendorName  1
    if i trigger idoc for example vendor 2005,2006 and 2010 data is getting updated in the table
    but again if i trigger idoc for same vendor nos data does not get updated in DB table while message is successfull in moni and RWB both
    plz suggest if any change need to be done to update the data
    Regards
    sandeep sharma

    Hi Ravi
    you are right, vendor no is my key field . problem is when i send data again then it should Update the data but it's not updating the data again
    i did on exp with this : i deleted all the record from the table and then  triggered idoc for vendor 2005 , 2006,2010 after this data is updated in the table i deleted the rows for vendor no 2006 and 2010 and kept the row for vendor 2005
    then i again trigered the idoc for vendor no 2005,2006 and 2010 now this should update and it should insert rows for vendor no 2006 and 2010 but i am surprised its not updating the data
    Thanks
    sandeep

Maybe you are looking for