Problems updateing a record on mdm

Hi All,
I am developing a solution in Web Dynpro to update the text of a product in mdm  5 sp6 using mdm api.
I have no compilation errors neither runtime errors.
I run the command to modify a record but nothing is changing in mdm.
Can you helpme with it ? i have urgence in this solution.
here is my code:
Record rec = materialDao.searchMaterial(matSearchDTO);
ConnectionAccessor conn = control.getConnection();
//Fazer checkout do registro
try {
     JoinCheckoutRecordsCommand outCmd = new JoinCheckoutRecordsCommand(conn);
     outCmd.setSession(control.getUserSession());
     outCmd.setTableId(tableIdTProdutos);
     outCmd.addRecordId(rec.getId());
     outCmd.execute();
} catch (Exception e) {
     //nao fazer nada pois o registro ja esta com checkout
//ALTERAR OS DADOS
if (multiTextoCurto != null)
     rec.setFieldValue(fieldIdTextoCurto, multiTextoCurto);
if (multiTextoLongo != null)
     rec.setFieldValue(fieldIdTextoLongo, multiTextoLongo);
if (mdmUnidadeBasica != null)
     rec.setFieldValue(fieldIdUnidadeBasica, mdmUnidadeBasica);
if (mdmUnidadePeso != null)
     rec.setFieldValue(fieldIdUnidadePeso, mdmUnidadePeso);
if (mdmUnidadeVolume != null)
     rec.setFieldValue(fieldIdUnidadeVolume, mdmUnidadeVolume);
if (mdmPesoBruto != null)
     rec.setFieldValue(fieldIdPesoBruto, mdmPesoBruto);
if (mdmPesoLiquido != null)
     rec.setFieldValue(fieldIdPesoLiquido, mdmPesoLiquido);
if (mdmVolume != null)
     rec.setFieldValue(fieldIdVolume, mdmVolume);
if (mdmDadoComplementario != null)
     rec.setFieldValue(fieldIdDadoCoplementario, mdmDadoComplementario);
//Modificar o registro
ModifyRecordCommand cmd = new ModifyRecordCommand(conn);
cmd.setRecord(rec);
cmd.setSession(control.getUserSession());
cmd.setModifyAnyway(true);
cmd.execute();

Diego, if this is the actual code, you have suppressed the exceptions by keeping the catch block empty.
Also keep your modify command statement in try / catch.
I would personaly test it by adding following steps:
Print the connection parameter, make sure connection is successful
Print the old values or one of the old values and the new value of a field to make sure you are sending the proper values.
Put a systemout/reportsuccess after execute and / or to make sure execute is done properly.
If everything is fine, just verify the update stamp of the record to verify if the record is getting updated or not. If the update stamp is not updated, that means the command never got executed properly.
Regards,
Nitin

Similar Messages

  • Problems updating BP record with SOAP

    Trying to update a business partner record with the SOAP env. below I get the error message: "Key not supplied". Where in the XML should I insert the key (CardCode) of the business partner I wish to update?
    <?xml version="1.0" encoding="UTF-16"?>
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
    <env:Header>
    <SessionID>A9DE2062-4F96-F9E1-DE3C-81E0DB23F174</SessionID>
    </env:Header>
    <env:Body>
    <dis:UpdateObject xmlns:dis="http://www.sap.com/SBO/DIS">
    <BOM>
    <BO>
    <AdmInfo>
    <Object>oBusinessPartners</Object>
    </AdmInfo>
    <BusinessPartners>
    <row>
    <CardCode>31177</CardCode>
    <FederalTaxID>987280115</FederalTaxID>
    </row>
    </BusinessPartners>
    </BO>
    </BOM>
    </dis:UpdateObject>
    </env:Body>
    </env:Envelope>

    For those interested I succsesfully managed to update a business partner record  with the follwing XML:
    (Replace $session_id with valid session id)
    [code]<?xml version="1.0" encoding="UTF-16"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
         <env:Header>
              <SessionID>$session_id</SessionID>
         </env:Header>
         <env:Body>
              <dis:UpdateObject xmlns:dis="http://www.soap.com/SBO/DIS">
                   <BOM>
                        <BO>
                             <AdmInfo>
                                  <Object>2</Object>
                                  <Version>2</Version>
                             </AdmInfo>
                             <QueryParams>
                                  <CardCode>30001</CardCode>
                             </QueryParams>
                             <BusinessPartners>
                                  <row>
                                       <ZipCode>5265</ZipCode>
                                  </row>
                             </BusinessPartners>
                        </BO>
                   </BOM>
              </dis:UpdateObject>
         </env:Body>
    </env:Envelope>
    [/code]

  • Req. Sample code for the Updation of Master record in MDM using Java API..

    Hi All,
    Can anyone provide me the same code for Updation of master record in MDM using Java API ??

    Hi SakthiNarayananD,
    You can additionally go through the following links to work with MDM and Java API:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49  (Java API)
    http://help.sap.com/javadocs/MDM/SP05/(Java api programs)
    https://help.sap.com/javadocs/MDM/current/index.html  (java api codes)
    http://help.sap.com/javadocs/MDM/SP06P2/index.html (Java Docs for SP06)
    Reg: Using JAVA API - Search
    Re: Retrieving Drop Down List Value using JAVA API - Lookup values
    How to retreive records from Lookuptable of type flat - Lookup Values
    Reg: MDM with webdynpro - READ,INSERT,MODIFY
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • Updating the  records  problem urgent

    Hi All,
    i have developed search page by using the query region. in that i have created update image icon to navigate update page to update the records. i have 4 search records, when i click the go button 4 records are come to the advance table. i will select any one of the row and select update icon to update the records by using the apply button in update page.when i click the apply button its navigate to the search page and showing only updated records row only. i did not get all 4 rows in advancetable.I re-query on the page, but I can’t get the other 3 rows back unless I close the page and come back in.
    here i am not facing any error, after update the records and come back to the main page i am not getting all records only updated row records Only 1 of the four rows only appear.
    can any one help me its urgent
    Thanks in advance.

    Hi Avajain, thanks for your reply.
    i have used below code for apply button.
    if (pageContext.getParameter("Apply") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    am.invokeMethod("apply");
    OAException message = new OAException("POS","MODPOS_PROGRAM_UPDATED_CONF",
    null,OAException.CONFIRMATION,null);
    pageContext.putDialogMessage(message);
    pageContext.forwardImmediately("OA.jsp?page=/xxaam/oracle/apps/pos/program/webui/SupProgramPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    AMCODE
    public void apply()
    getTransaction().commit();
    Thanks

  • Update Multiple records using NW CE WebDyn Pro 7.2 interface ITEMDETAILS

    We are trying to use SAP Netweaver CE 7.2 and NetWeaver Design Studio 7.2 with the Web Dynpro application interfaces configured to connect to our MDM 7.1 SP06 repositories to develop web screens that allow our end users the ability to maintain MDM repository data without the use of DataManager.
         Our first application was to be a simple one to show the business the benefit of SAP Netweaver. Itu2019s very easy to use the interfaces for SEARCH, RESULTSET, ITEMDETAILS, MATCH and MERGE if you plan to maintain one record at a time. We would like to update many records at the same time.
    Using the configuration described previously, I find that I am able to select multiple records at one time using the RESULTSET interface and the Context folder of u201CSelectedRecordsu201D but I am not able to pass multiple records at one time to the context u201CIODatau201D used by the ITEMDETAILS interface and allow my end users to see and update multiple records at one time.
    If I can pass multiple records from RESULTSET to ITEMDETAILS for display and update would you please provide me with an example of how I would do this in NetWeaver Design Studio for NW CE 7.2..
    If I can NOT pass multiple records from RESULTSET to ITEMDETAILS for display and update, Would I then have to write my own wrapper application to read multiple records selected using the RESULTSET interface and the develop my own UPDATE view to display and update more than one record at a time. This would be time consuming since I would also have to write my own back out procedures and validation of update procedures that already happen within ITEMDETAILS.  Do you happen to have any CE application examples that show how this is done for a NW CE MDM repository that I can see? The current documentation u201CHow to Build Web Applications Using MDM Web Dynpro Components. pdfu201D falls short in the area of updating multiple records.
    Thank you in Advance

    Bugs aside, if it's VERY noisy, that might just be the out-of-sync problem (something I'm very familiar with now).
    Search the forum for "aggregate sync" and you should get some clues, if this is indeed the problem.
    Short of it is, you need to sync the two devices together. Easiest way seems to be to connect the two devices via S/PDIF and set Clock Source to S/PDIF for the "slave" device (set in Audio Midi).
    You can also just set the Clock Source as the "master" device in the drop down, bypassing the need for the S/PDIF cable altogether, but I haven't tried this myself.
    Macbook Pro CD / iMac C2D   Mac OS X (10.4.8)  

  • Problems with automatic syndications in MDM 5.5 SP6

    Hi all,
    Has anyone a solution for the following problem?
    I have a MDM repository for central master data management for articles. This i running under MDM 5.5 SP6. I use timestamps depending on spesific fields in order to execute the syndications. Most of the syndications are running automaticly and continously, with some few seconds delay between the syndication rounds.
    Each syndication takes some few seconds, appr. 10-15. When an end-user save the change, and the timestamp for the actual change happens to be in between the start/end of the belonging syndication, the record is not included in the syndication, and it seems that the status telling the mdm system that a record has been changed, is reset, although the record has not been syndicated. Thus the record is not included in the next syndication round either.
    I appreciate if anyone could help me.
    Regards,
    Jens

    Hi Jens,
    Workaround could be to use MDM Workflows.
    Design the workflow as shown below
    Start -> Branch -> Syndicate -> Stop
                           -> Stop
    Just pass the outbound port of type manual to the syndicate step and set the trigger action of the workflow to record update. Now whenever record gets updated, its time stamp gets modified and the workflow gets launched. If it is the desired record then it clears the validation step and go to syndicate step. Syndicate step just mark the records for syndication, it doesn't actually syndicates it. At the last it is the job of syndication server to actually syndicate the records. With this design you will get all the updates records.
    Regards,
    Jitesh Talreja

  • Error while updating a record in MS Access

    Im new to coldfusion and am running into a problem while
    trying to update a record in a MS Access table.
    I have a MS Access table where the primary key is a
    auto-number long integer field named jobid.
    I have an edit form where info can be changed then saved. A
    hidden form field named jobid holds the records primary key field
    value for the record being edited. When submitted this is what
    happens:
    I use a basic SQL UPDATE statement but I get the error "Data
    type mismatch in criteria expression"
    Some code:
    <cfset nJobId=Int(Val(FORM.jobid))>
    *dont know if i need the above line but using #FORM.jobid#
    in the WHERE clause below didnt work either
    <cfquery datasource="lrs">
    UPDATE jobs SET
    status='#FORM.status#',
    offer='#FORM.offer#',
    postdate="#CreateODBCDate(FORM.postdate)#",
    jobtype=#FORM.jobtype#,
    jobtitle='#FORM.jobtitle#',
    ..etc...
    WHERE jobid=#nJobId#
    The WHERE clause is where the error occurs with "Data type
    mismatch in criteria expression"
    After a few times with that i changed the where clause to
    simply "WHERE jobid=1" as this record id does exist, but it has the
    same error.
    I then tried changing the where clause to
    WHERE jobid=<cfqueryparam cfsqltype="cf_sql_bigint"
    value="#FORM.jobid#">
    and there it "appears" to work, but the record is not
    actually updated. No changes are made to the table though no error
    is thrown.
    Im missing something here... why wont the record update
    ?

    The data type mismatch isn't necessarily in your where
    clause. I'm guessing that it's the quotes around the create
    odbcdate function.
    use of cfqueryparam will solve a lot of these problems for
    you.

  • Error in updating BO record

    Hi all,
           I am trying to update one of the attribute of BO record by calling update function of BO in an application service. But i am getting an error message " Entity is locked by user guest".
    I have written following code.
    // getting service instance
                       OrderStatusServiceLocal orderstatusBOinstance = getOrderStatusService();
    //getting a specific record
            OrderStatus orderrecord = orderstatusBOinstance.readByCustomKeys(orderid);
    //changing one of attribute
            orderrecord.setApprovalstatus(newstatus);
    //updating the record
            orderstatusBOinstance.update(orderrecord);
    Can anybody guide me in removing this error.
    thanks in advance
    Reena

    I have checked the code. There is no problem in the current portion of the code, you have provided (I was wrongly thinking it should be insert into....!! mistake)
    I have tested with Oracle Database and classes12.zip in classpath. It ran smoothly.

  • Can't update mysql records from a web page

    Hi everybody,
    I am beginning with Dreamweaver CS5.
    I followed a video tutorial on how to visually design a data entry/update web page for a mysql database using server behaviors.
    My problem is that I was able to insert records and see inserted records but when I try to update a record it doesn't work.
    I don't get any error message, it just redirects me to the listing page as it's supposed to but doesn't take into account the changes I made.
    Below are 2 printscreens along with the corresponding code.
    Can someone help me please?
    Records list web page :
    Records list code :
    <?php require_once('Connections/dw_nouvellenaissance.php'); ?>
    <?php
    // *** Display of registered users
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_dw_nouvellenaissance, $dw_nouvellenaissance);
    $query_users_videostream = "SELECT * FROM videostream_users";
    $users_videostream = mysql_query($query_users_videostream, $dw_nouvellenaissance) or die(mysql_error());
    $row_users_videostream = mysql_fetch_assoc($users_videostream);
    $totalRows_users_videostream = mysql_num_rows($users_videostream);mysql_select_db($database_dw_nouvellenaissance, $dw_nouvellenaissance);
    $query_users_videostream = "SELECT * FROM videostream_users";
    $users_videostream = mysql_query($query_users_videostream, $dw_nouvellenaissance) or die(mysql_error());
    $row_users_videostream = mysql_fetch_assoc($users_videostream);
    $totalRows_users_videostream = mysql_num_rows($users_videostream);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Videostream Users List</title>
    </head>
    <body>
    <h3 align="center">Videostream Users List </h3>
    <table  align="center" width="75%" border="1" cellspacing="0" cellpadding="0">
    <tr align="center" BGCOLOR="#99CCFF">
          <th>Surname</th>
          <th>Name</th>
          <th>City</th>
          <th>UserID</th>
          <th>Password</th>
          <th>Edit</th>
          <th>Delete</th>
        </tr>
    <?php do { ?>
        <tr align="center">
          <td><?php echo $row_users_videostream['Nom'];?></td>
          <td><?php echo $row_users_videostream['Prenom'];?></td>
          <td><?php echo $row_users_videostream['Ville'];?></td>
          <td><?php echo $row_users_videostream['user_name'];?></td>
          <td><?php echo $row_users_videostream['user_password'];?></td>
          <td><a href="modifyuser.php?User_id=<?php echo $row_users_videostream['User_id']; ?>"><img src="images/edit.png" alt="modifier" width="15" height="15" hspace="5" /></a>
          <td><a href="deleteuser.php?User_id=<?php echo $row_users_videostream['User_id']; ?>"><img src="images/delete.png" alt="supprimer" width="15" height="15" hspace="5" /></a></td>
        </tr>
    <?php } while ($row_users_videostream = mysql_fetch_assoc($users_videostream)); ?>
    </table>
    <p> </p>
    <p align="center"><a href="formlogoutadmin.php">Deconnexion</a></p>
    </body>
    </html>
    </body>
    </html>
    <?php
    mysql_free_result($users_videostream);
    ?>
    Udate records web page:
    Update records code:
    <?php require_once('Connections/dw_nouvellenaissance.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    //*** Update User
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "usersform")) {
      $updateSQL = sprintf("UPDATE videostream_users SET Nom=%s, Prenom=%s, Ville=%s, user_name=%s, user_password=%s WHERE User_id=%s",
                           GetSQLValueString($_POST['Nom'], "text"),
                           GetSQLValueString($_POST['Prenom'], "text"),
                           GetSQLValueString($_POST['Ville'], "text"),
                           GetSQLValueString($_POST['user_name'], "text"),
                           GetSQLValueString($_POST['user_password'], "text"),
                           GetSQLValueString($_POST['User_id'], "int"));
      mysql_select_db($database_dw_nouvellenaissance, $dw_nouvellenaissance);
      $Result1 = mysql_query($updateSQL, $dw_nouvellenaissance) or die(mysql_error());
      $updateGoTo = "showusers.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    $colname_users = "-1";
    if (isset($_GET['User_id'])) {
      $colname_users = $_GET['User_id'];
    mysql_select_db($database_dw_nouvellenaissance, $dw_nouvellenaissance);
    $query_users = sprintf("SELECT * FROM videostream_users WHERE User_id = %s", GetSQLValueString($colname_users, "int"));
    $users = mysql_query($query_users, $dw_nouvellenaissance) or die(mysql_error());
    $row_users = mysql_fetch_assoc($users);
    $totalRows_users = mysql_num_rows($users);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=charset=iso-8859-15" />
    <title>Modify User</title>
    </head>
    <body>
    <h1>Welcome Daniel</h1>
    <h3 align="left">Please modify user fields then click OK</h3>
    <form action="<?php echo $editFormAction; ?>" method="POST" name="usersform" id="usersform">
    <input name="User_id" type="hidden" value="" />
    <table align="left" width="50%">
      <tr align="left">
      <th>Surname: </th><td><input name="Nom" type="text" id="Nom" value="<?php echo $row_users['Nom']; ?>" /></td>
    </tr>
    <tr align="left">
      <th>Name :</th><td><input name="Prenom" type="text" id="Prenom" value="<?php echo $row_users['Prenom']; ?>" /></td>
    </tr>
    <tr align="left">
       <th>City: </th><td><input name="Ville" type="text" id="Ville" value="<?php echo $row_users['Ville']; ?>" /></td>
    </tr>
    <tr align="left">
      <th>User ID:</th><td><input name="user_name" type="text" id="user_name" value="<?php echo $row_users['user_name']; ?>" /></td>
    </tr>
    <tr align="left">
    <th>Password:</th><td><input name="user_password" type="text" id="user_password" value="<?php echo $row_users['user_password']; ?>" /></td>
    </tr>
    <tr align="left">
    <td> </td><td align="left"><input type="submit" name="valider" value="Update" /></td>
    </tr>
    </table>
    <input type="hidden" name="MM_update" value="usersform" />
    </form>
    </body>
    </html>
    <?php
    mysql_free_result($users);
    ?>

    Daniel Cronin,
    This link has information on preparing movies for viewing online by an iPhone:
    https://developer.apple.com/iphone/devcenter/designingcontent.html
    Click on the drop down menu for "Ensure a Great Audio and Video Experience".
    You may need to register for Apple Developer Connection in order to view that information.
    Hope this helps,
    Nathan C.

  • Subsequent update of record, long time to appear in Journalized View

    Hi,
    I'm running some integration tests that do an insert into a source table, commits the insert, updates that record, commits the update. The cscn numbers are widely spaced, for example, the insert is 69997742 and the update is 70000579. I have a scheduled scenario running every few minutes that as a first step, extends window and locks subscriber.
    What I'm seeing is the Insert will get propagated to the target immediately, but then the cscn number doesn't change for a long time, and at some random time in the future it will be updated and the update record will make it throguh to the target. I'm seeing time differences of 7 - 11 minutes between the arrival of the insert to the target and the arrival of the update.
    Does anyone know how to decrease this "latency", is there a way of speeding up the time it takes for the cscn number to increment?
    I found the following two tuning commands and have tried them, but I'm still seeing a long period of time between the insert and update,
    begin dbms_capture_adm.alter_capture(capture_name=>'CDC$C_SAMS_INTEG', checkpoint_retention_time => 7); end;
    begin dbms_capture_adm.set_parameter('CDC$C_SAMS_INTEG', 'parallelism','4'); end;
    Any ideas would be appreciated!
    Cheers
    Damian

    We temporarily solved the problem by switching to synchronous CDC. When we ran a performance analyzer over the database while data capture was taking place we found logmnr was taking around 6 minutes to query the data dictionary which looked like this bug: https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=458214.1 which is apparently fixed. So the either the bug isnt fixed or we haven't configured the database correctly. Anyone know a good tutorial for getting the right configuration for archive logging, number of redo logs and their size, and retention policies etc?

  • Updating a record using variables

    I want to use a variable(s) to update my record. I get a Java excpetion when using this code:
    <%@ page import="java.sql.*"%>
    <%@ include file = "/html/common/init.jsp" %>
    <% String ticketid = request.getParameter("ticketid"); %>
    <% String comment = request.getParameter("comment"); %>
    <% String userid = user.getUserId(); %>
    <% String comment_body = "comment_body" %>
    <%
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/helpdesk", "root", "password");
    Statement updStmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    ResultSet updRs = updStmt.executeQuery("SELECT * FROM HISTORY WHERE (ticketid) = ('"+ticketid+"')");
    updRs.next();
    updRs.updateString "('"+comment_body+"', '"+comment+"')";
    updRs.updateRow();
    con.close();
    %>
    Here is the exception;
    An error occurred at line: 7 in the jsp file: /Projects/Help Desk/PostComments.jsp
    Generated servlet error:
    C:\Program Files\Liferay\server\default\work\jboss.web\localhost\_\org\apache\jsp\Projects\Help_0020Desk\PostComments_jsp.java:546: ';' expected
    String comment_body = "comment_body"
    ^
    An error occurred at line: 10 in the jsp file: /Projects/Help Desk/PostComments.jsp
    Generated servlet error:
    C:\Program Files\Liferay\server\default\work\jboss.web\localhost\_\org\apache\jsp\Projects\Help_0020Desk\PostComments_jsp.java:558: not a statement
    updRs.updateString "('"+comment_body+"', '"+comment+"')";
    ^
    An error occurred at line: 10 in the jsp file: /Projects/Help Desk/PostComments.jsp
    Generated servlet error:
    C:\Program Files\Liferay\server\default\work\jboss.web\localhost\_\org\apache\jsp\Projects\Help_0020Desk\PostComments_jsp.java:558: ';' expected
    updRs.updateString "('"+comment_body+"', '"+comment+"')";
    ^
    3 errors

    Thanks for the insult.<rant>
    Your problem was that you were missing a semi-colon at the end of line, which every Java statement requires. The error messages that you posted would tell most people who have more than casual experience with compiling Java that you have a trivial syntax problem.
    The people who take the time to answer the questions in this forum are mostly experienced professionals who answer questions on a volunteer basis out of the goodness of their heart. It takes time, it takes work, and we get the gratification of helping people, learning about new problems, and learning the tricks that the other pros know that we don't. Therefore it is frustrating to see a problem that ought to be solvable by anyone who's gotten past their first program harder than "hello world".
    However, I don't see anything insulting in our responses so far, or about saying that the impression I have from this and all your other posts is that you don't have the first idea about how to do what you're trying to do and you want this forum to design your application for you. While design questions are certainly appropriate in the forum, both the basic level and the number of your questions suggest that you really need to spend some time getting educated, by reading books, all the Java "how to" articles on the web, or examining the code of all the open source projects that happen to do similar things. Or you should go to school, hire a tutor, or a mentor within your development environment. You're acting like you expect the forum to do your work for you, and be polite and happy about it.
    I appreciate that trying to learn all these areas of Java at once is very hard and can be frustrating; it's taken me about 5 years to get to "above average" in some areas and I still have an enourmous amount to learn about other areas, even though I started as a senior programmer who has been working in non-Java, non-web areas for 25 years. Learning new technologies takes an enormous amount of work; your posting of an issue that many college freshman solve in their first "hands-on" project suggests to me that you are utterly unwilling to do your own work or take the time to think about your problems before posting. I write that not to insult you - it's truly how I feel - but to help you understand why you might not be getting the answers you seek in this forum; for many of us, you're just asking too much and whining about "insults" doesn't help your cause.
    Sorry if we hurt your feelings. After that rant, I'm going to attempt to restrict my responses to the technical issues at hand.
    </rant>

  • How To Update A Record?  What is Wrong With My Code?

    I tried to update a record and got the
    java.lang.ArrayIndexOutOfBoundsException: 0
    Here is my code:
       public void updateLastPostMemberName(int threadID, // primary key
                                            String lastPostMemberName)
                                            throws ObjectNotFoundException, MessageDAOSysException
          Connection conn = null;
          PreparedStatement stmt = null;
          String sql = "UPDATE message_thread SET last_post_member_name = '" + lastPostMemberName + "' WHERE thread_id = '" + threadID + "'";
          try
             conn = DBConnection.getDBConnection();
             stmt = conn.prepareStatement( sql );
             stmt.setString( 1, lastPostMemberName ); // this is the statement where the error occurred.
             stmt.executeUpdate();
          catch( SQLException se )
             System.out.println( se.getMessage() );
             se.printStackTrace();
             throw new MessageDAOSysException( "Error executing SQL in ThreadHandler.updateLastPostMemberName." );
          finally
             if ( conn != null )
                try
                   stmt.close();
                   stmt = null;
                   conn.close();
                catch( SQLException sqlEx )
                   System.out.println( "Problem occurs while closing " + sqlEx );
                conn = null;
       }

    Natalie,
    try this...
    public void updateLastPostMemberName(int threadID, // primary key
                                          String lastPostMemberName) throws ObjectNotFoundException,
                                                                       MessageDAOSysException {
      Connection conn = null;
      PreparedStatement stmt = null;
      String sql = "UPDATE message_thread SET last_post_member_name = ? WHERE thread_id = ?";
      try {
        conn = DBConnection.getDBConnection();
        stmt = conn.prepareStatement( sql );
        stmt.setString( 1, lastPostMemberName );
        stmt.setInt(2, threadID);
        stmt.executeUpdate();
      catch( SQLException se ) {
        System.out.println( se.getMessage() );
        se.printStackTrace();
        throw new MessageDAOSysException(
    "Error executing SQL in ThreadHandler.updateLastPostMemberName." );
      finally {
        if ( conn != null ) {
          try {
            stmt.close();
            stmt = null;
            conn.close();
          catch( SQLException sqlEx ) {
            System.out.println( "Problem occurs while closing " + sqlEx );
          conn = null;
    }Good Luck,
    Avi.

  • Updating a record on a certain date

    Hi,
    I have a little problem with updating a record on a certain
    date specified in the same table.
    OK so i have a table called 'users' and in that table i have
    the following fields:
    AdID
    Username
    AdStatus
    AdStartDate
    AdPeriod
    (and a few more but i've listed the important ones here)
    What i have done is, when a user places an AD, it inserts
    into the table the user's username, the ad status (e.g. Active,
    Suspended ect), the day on which the advert was placed, the period
    the ad has been placed for (e.g 6 months, 1 yr, 2yr ect).
    What i would like to do is to create an auntomatic function
    that checks the date in the table, and see if it is 6 months, 1yr,
    2yr old or whatever and if it is, update the status to suspended.
    Problem is, i dont know how :(
    I thought about adding a countdown script and when it reaches
    Zero, run a stored procedure but i dont know anything about them.
    Could somebody PLEASE help me this is driving me mad. I've
    been trying all kinds of ways but no luck. Anyone with the 'know
    how' that can point me in the right direction would be a BIG start.
    I am using ASP.VB and MYSQL 5.
    Thankyou in Advance,
    Adam

    muzicmistro wrote:
    > What i have done is, when a user places an AD, it
    inserts into the table the
    > user's username, the ad status (e.g. Active, Suspended
    ect), the day on which
    > the advert was placed, the period the ad has been placed
    for (e.g 6 months, 1
    > yr, 2yr ect).
    >
    > I am using ASP.VB and MYSQL 5.
    I can't help you with the ASP side of it, but since you're
    using MySQL,
    you could simplify your problem by adopting a different
    approach. Add an
    expiry_date column (DATETIME type) and use the MySQL
    DATE_ADD() function
    to insert the date on which the ad expires. If your minimum
    period is
    one month, you can simply use MONTH as the the period in
    DATE_ADD, and
    use a variable to change the number of months (e.g., 24 for 2
    years).
    INSERT INTO myTable (expiry_date, other_cols)
    VALUES(DATE_ADD(NOW(), INTERVAL x MONTH), other_vals)
    http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
    Rather than have an active/expired column, just use the
    expiry_date and
    compare it with the current date. If it's greater, the ad is
    still
    active. If it's less, the ad has expired.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • HTTPS, DNS and dynamically updating DNS records

    Hello to you all, if you are able to help with a DNS problem that I'm having then please accept my thanks and appreciation in advance.
    First some background information, I recently  moved my server from my studio to my house where a new purpose built studio will soon be erected. At my old studio any requests for myurl.com came in via the IP (whether that be http, https, ftp etc) from the domain registrar and the router would send the request to the relevant port number whether that be 80 for http or 443 for https etc and all was well as this location had a fixed IP address. Unfortunately at my new location whilst I have a much faster connection I do not have a fixed IP. To get around this I have the following set up (not ideal for a business I know but perfectly OK for home hosting); I set up two psuedo nameservers at no-ip.com (ns1myurl.com and ns2myurl.com) which tracks the changes in my IP address and updates its records accordingly, my registrar then sends any requests to these 'nameservers' and no-ip then forwards it on to my server. So far so good.
    The problem arises once the requests get to my server, whilst I have DNS set up, I can only recieve requests from a straight request to the server ie myurl.com will display the site without any problem, but if I then put a www in front of that or try to access the https part of my site (which is set up as a seperate site on the same server) then the server throws an error. I have tried to put an alias (CNAME) into the zone but it does not want to resolve the request. I have searched around but to no avail, I am totally new to DNS so am currently on a steep learning curve and fumbling around in the dark.
    The first thing that I need to get working is the request to be resolved correctly and then (and this is where the real fun starts!) is to dynamically update the IP in the DNS records as the IP changes. I will probably have to get help in on this as I understand that this requires BIND of which I know nothing about, first though I'd like to get the pages to be served up correctly. Advice, hints, tips or links to tutorials all greatly appreciated. Full set up listed below.
    Many thanks, David.
    Xserve PPC G5 running 10.5.8 unlimited set up as standalone OD master
    Xraid
    APC UPS
    CradlePoint MBR1200 Gateway router which acts as the DHCP
    http://myurl.com and https://myurl.com set up as 2 seperate sites and located on the Xraid
    Current DNS setup:
    Primary Zone name: myurl.com with nameservers ns1myurl.no-ip.info and ns2myurl.no-ip.info and allow zone transfers in checked
    Then
    Name
    Type
    Value
    myurl.com
    Primary Zone
            ns1myurl.no-ip.info
            Machine
    12.34.56.78 (external IP)
            ns2myurl.no-ip.info
            Machine
    12.34.56.78 (external IP)
            myurl.com.
            Machine
    12.34.56.78 (external IP)
            www.myurl.com.
            Alias
    myurl.com.
    With the reverse zone looking thus with allow zone transfers being checked
    Name
    Type
    Value
    56.34.12.in-addr.arpa.
    Reverse Zone
            12.34.56.78
            Reverse mapping
            myurl.com.

    Thanks for the reply Camelot, that part though I had already figured out. I now have this working, all I did was change the external IP to the internal one of the server with resolves with the .local machine name and all is working just fine (for now!). As long as I have primary zones set for each site and any alias or services set up on them then everything works well.. The real test will be when my ISP changes the IP, whilst my tests have proved successful the proof will be when they update the address.
    Thanks anyway. David.

  • Update a record is updating the first record in the DB...HELP!

    I am going over and over this again and cant find the problem.
    i have a form that sends email to emails that are on a php mysql db however when i update certain records it always is updating the first record in the DB...i have looked over this so many times and cant see what is going wrong
    the userid is not auto_increment but is based on the username (these are all unique)
    i have uncluded the code to see if i am missing something
    <?php require_once('../Connections/hostprop.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE plus_signup SET email=%s, emailerSubject=%s, emailerContent=%s WHERE userid=%s",
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['emailerSubject'], "text"),
                           GetSQLValueString($_POST['emailerContent'], "text"),
                           GetSQLValueString($_POST['userid'], "text"));
      mysql_select_db($database_hostprop, $hostprop);
      $Result1 = mysql_query($updateSQL, $hostprop) or die(mysql_error());
          // Email Guarantor
              $to = $_POST['email'];
              $subject = "Email From Host Student Property";
              $message = "
              <html>
                        <head>
                                  <title>Dear ".GetSQLValueString($_POST['userid'], "text")."</title>
                        </head>
                        <body>
                                  <img src=\"http://www.hoststudent.co.uk/beta/images/hostlogo.gif\" alt=\"www.HostStudent.co.uk\" />
                                  <h2>An Email From Host Students</h2>
                                  <br /><br />
                                  <table>
                                            <tr>
                                                      <td>Email Subject:</td>
                                            </tr>
                                            <tr>
                                                      <td>".GetSQLValueString($_POST['emailerSubject'], "text")."</td>
                                            </tr>
                                            <tr>
                                                      <td>Email Content</td>
                                            </tr>
                                            <tr>
                                                      <td>".GetSQLValueString($_POST['emailerContent'], "text")."</td>
                                            </tr>
                                  </table>
                        </body>
              </html>
              // Always set content-type when sending HTML email
              $headers = "MIME-Version: 1.0" . "\r\n";
              $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
              $headers .= 'From: HostStudent.co.uk <[email protected]>' . "\r\n";
              $send = mail($to,$subject,$message,$headers);
      $updateGoTo = "TenantEmailSent.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    mysql_select_db($database_hostprop, $hostprop);
    $query_Recordset1 = "SELECT userid, email, emailerSubject, emailerContent FROM plus_signup";
    $Recordset1 = mysql_query($query_Recordset1, $hostprop) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?
              session_start();
              if(!$_SESSION['loggedIn']) // If the user IS NOT logged in, forward them back to the login page
                        header("location:Login.html");
    ?>
       <script type="text/javascript">
    function loadFields(Value) {
             var Guarantor = Value.split("|");
              var userid1 = Guarantor[0] ;
                          var GuName = Guarantor[1];
              var GuPhoneEmail = Guarantor[2] ;
              document.getElementById('userid1').value=userid1;
                          document.getElementById('GuName').value=GuName;
              document.getElementById('GuPhoneEmail').value=GuPhoneEmail;
    </script>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
                  <table align="center">
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"> </td>
            <td><select name="userid" id="userid" onchange="loadFields(this.value)">
              <option value="Select Guarantor">Select Guarantor</option>
              <?php
    do {
    ?>
    <option value="<?php echo $row_Recordset1['userid'] . '|' . $row_Recordset1['GuName'] . '|' . $row_Recordset1['GuPhoneEmail'];?>"><?php echo $row_Recordset1['userid'] . " , " . $row_Recordset1['GuName'] . " , " . $row_Recordset1['GuPhoneEmail']; ?></option>
              <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
      $rows = mysql_num_rows($Recordset1);
      if($rows > 0) {
          mysql_data_seek($Recordset1, 0);
                $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    ?>
            </select></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">Tenant Name</td>
            <td><input type="text" name="userid1" id="userid1" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['userid'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuName:</td>
            <td><input type="text" name="GuName" id="GuName" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['GuName'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuPhoneEmail:</td>
            <td><input type="text" name="GuPhoneEmail" id="GuPhoneEmail" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['GuPhoneEmail'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuEmailerSubject:</td>
            <td><input type="text" name="GuEmailerSubject" value="" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">GuEmailerContent:</td>
            <td><textarea name="GuEmailerContent" cols="45" rows="5"> </textarea></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"> </td>
            <td><input type="submit" value="Send email" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"></td>
            <td> </td>
          </tr>
                  </table>
        <input type="hidden" name="MM_update" value="form2" />
        <input type="hidden" name="userid" value="<?php echo $row_Recordset1['userid']; ?>" />
    </form>

    i have found the problem, there were two forms with the same name..
    thanks

Maybe you are looking for