Updating a databse using jsp. Wierd problem

Can anyone help me with this wierd problem.
I update a databse using:
stmt.executeUpdate("UPDATE status_table SET " + updateString + " WHERE login = '" + userLogin + "'");
The updateString is:
otrans_comments = 'Please submit certified true photocopies of your individual marksheets for each semester/year of bachelor's work as issed by Thapar Institute'
as collected by a HTML form.
Observe that there is an apostrophie in bachelor's and this would cause pblms. I do not want to restrict users from stopping the use of apostrophie and neither can I remove apostrophie using other Java.String methods.
Is there any other way?

And by the way if this helps. I make my updateString like this:
comma="";
updateString="";
for (Enumeration en=request.getParameterNames();
en.hasMoreElements();) {
String name = (String)en.nextElement();
String value = request.getParameter(name);
// added to replace ' with `
if(name.endsWith("_comments")){
     String newValue=value.replace('\'','`');
value=newValue;
     updateString += comma + name + " = \'" + value + "\'";
comma = ", ";

Similar Messages

  • Pls help... on update to access using jsp

    hie.. need some urgent help here... i cant seem to be able to update to the database... its output would show all the else statement... hope this would be sufficient info... would appreciate every help..
    Below is the table layout
    Table: RenRec
    RentID(PK)
    CarID
    CustID
    Status
    Below is the update code...
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection = DriverManager.getConnection("jdbc:odbc:EDC","","");
    Statement statement = connection.createStatement();
    int status = 0;
    int id = Integer.parseInt(request.getParameter("RentID"));
    String s = request.getParameter("Status");
    String c = request.getParameter("CarID");
    try {     
    status = statement.executeUpdate("UPDATE RenRec SET Status='"+s+"' WHERE RentID='"+id+"' AND CarID='"+c+"'");
    } catch (SQLException sqle)
         out.println("Error! No data Updated!");
    if (status > 0)
    ResultSet columns = statement.executeQuery("SELECT * FROM RenRec WHERE RentID='"+id+"'");
    while (columns.next()) {
    id = columns.getInt("RentID");
    String id1 = columns.getString("CustID");
    c = columns.getString("CarID");
    s = columns.getString("Branch");
    %>
         <tr>
         <td> <%=id%> </td>
         <td> <%=id1%> </td>
         <td> <%=c%> </td>
         <td> <%=s%> </td>
    <% }
    else
         out.println("<H2><a href=\"AddItem.html\">Click to continue</a></H2>");
    if (status > 0)
         statement.executeUpdate("UPDATE Car SET Status='"+s+"' WHERE CarID='"+c+"'");
    else
         out.println("");
    statement.close();
    connection.close();
    %>

    its ok guys... i got the solution... thnx to those who view it...

  • Use JSP update MSSQL server with Chinese content

    Hi,
    I am using weblogic 7.0 server
    win2k english version with Trad.Chinese support. Default encoding is en.
    MS SQL server with database collate in Chinese_Taiwan_Stroke
    I can use SQl server's query analyser to insert Chinese characters
    and after modifying
    web.xml and weblogic.xml
    to include InputChar as Big5 and encoding as Big5
    I can also use JSP's getParameter() to get Chinese characters from form
    input.
    Now the problem is,
    when I use JSP to execute a UPDATE or INSERT statement to the database, and
    if the SQL statement contains chinese characters as content
    (like INSERT into table1 (field1) values ('some chinese characters'))
    the statement is executed without error,
    but the content updated in SQL server becomes "???" for all Chinese
    characters.
    Would anyone please kindly help? Thanks!

    Hi,
    Have you checked that your DOS panel that starts your windows is correctly
    set ? (see CHCP values)
    I guess that can have some influence on the Java processes when updating and
    insterting.
    Best regards
    Nohmenn BABAI
    "newsgroups.bea.com" <[email protected]> a écrit dans le message de
    news: [email protected]..
    Hi,
    I am using weblogic 7.0 server
    win2k english version with Trad.Chinese support. Default encoding is en.
    MS SQL server with database collate in Chinese_Taiwan_Stroke
    I can use SQl server's query analyser to insert Chinese characters
    and after modifying
    web.xml and weblogic.xml
    to include InputChar as Big5 and encoding as Big5
    I can also use JSP's getParameter() to get Chinese characters from form
    input.
    Now the problem is,
    when I use JSP to execute a UPDATE or INSERT statement to the database,and
    if the SQL statement contains chinese characters as content
    (like INSERT into table1 (field1) values ('some chinese characters'))
    the statement is executed without error,
    but the content updated in SQL server becomes "???" for all Chinese
    characters.
    Would anyone please kindly help? Thanks!

  • Problem when updating delivery quantity using 'BAPI_OUTB_DELIVERY_CHANGE'

    Hi experts,
    I have a requirement in which i need to update the material's delivery quantity in VL03N transaction.   For this im trying the BAPI
    'BAPI_OUTB_DELIVERY_CHANGE' and im passing the following values.
    HEADER_DATA : Delivery no.
    DELIVER : Delivery no.
    ITEM_DATA : Delivery no,
    item no,
    DLV_QTY quantity(changed),
    FACT_UNIT_NOM ( default to value '1')
    FACT_UNIT_DENOM ( default to value '1')
    ITEM_CONTROL : Delivey no,
    item no,
    CHG_DELQTY ( value "X")
    Then i use 'BAPI_TRANSACTION_COMMIT' for updating the changes. 
    Here the problem is, the BAPI is working fine for some quantity , say if i enter the DLV_QTY as 2 in ITEM_DATA, it is gettting updated.  But if i pass some other quantity , say 12, it is returning the folowing error.
    T ID                   NUM MESSAGE
    E VL                   363
    Pls tell why this error comes. and how to successfully update the delivery quantity for a set of material?
    Regards,
    Shanthi

    not answered

  • How can I use multiple row insert or update into DB in JSP?

    Hi all,
    pls help for my question.
    "How can I use multiple rows insert or update into DB in JSP?"
    I mean I will insert or update the multiple records like grid component. All the data I enter will go into the DB.
    With thanks,

    That isn't true. Different SQL databases have
    different capabilities and use different syntax, That's true - every database has its own quirks and extensions. No disagreement there. But they all follow ANSI SQL for CRUD operations. Since the OP said they wanted to do INSERTs and UPDATEs in batches, I assumed that ANSI SQL was sufficient.
    I'd argue that it's best to use ANSI SQL as much as possible, especially if you want your JDBC code to be portable between databases.
    and there are also a lot of different ways of talking to
    SQL databases that are possible in JSP, from using
    plain old java.sql.* in scriptlets to using the
    jstlsql taglib. I've done maintenance on both, and
    they are as different as night and day.Right, because you don't maintain JSP and Java classes the same way. No news there. Both java.sql and JSTL sql taglib are both based on SQL and JDBC. Same difference, except that one uses tags and the other doesn't. Both are Java JDBC code in the end.
    Well, sure. As long as you only want to update rows
    with the same value in column 2. I had the impression
    he wanted to update a whole table. If he only meant
    update all rows with the same value in a given column
    with the same value, that's trivial. All updates do
    that. But as far as I know there's know way to update
    more than one row where the values are different.I used this as an example to demonstrate that it's possible to UPDATE more than one row at a time. If I have 1,000 rows, and each one is a separate UPDATE statement that's unique from all the others, I guess I'd have to write 1,000 UPDATE statements. It's possible to have them all either succeed or fail as a single unit of work. I'm pointing out transaction, because they weren't coming up in the discussion.
    Unless you're using MySQL, for instance. I only have
    experience with MySQL and M$ SQL Server, so I don't
    know what PostgreSQL, Oracle, Sybase, DB2 and all the
    rest are capable of, but I know for sure that MySQL
    can insert multiple rows while SQL Server can't (or at
    least I've never seen the syntax for doing it if it
    does).Right, but this syntax seems to be specific to MySQL The moment you use it, you're locked into MySQL. There are other ways to accomplish the same thing with ANSI SQL.
    Don't assume that all SQL databases are the same.
    They're not, and it can really screw you up badly if
    you assume you can deploy a project you've developed
    with one database in an environment where you have to
    use a different one. Even different versions of the
    same database can have huge differences. I recommend
    you get a copy of the O'Reilly book, SQL in a
    Nutshell. It covers the most common DBMSes and does a
    good job of pointing out the differences.Yes, I understand that.
    It's funny that you're telling me not to assume that all SQL databases are the same. You're the one who's proposing that the OP use a MySQL-specific extension.
    I haven't looked at the MySQL docs to find out how the syntax you're suggesting works. What if one value set INSERT succeeds and the next one fails? Does MySQL roll back the successful INSERT? Is the unit of work under the JDBC driver's control with autoCommit?
    The OP is free to follow your suggestion. I'm pointing out that there are transactions for units of work and ANSI SQL ways to accomplish the same thing.

  • I have lightroom 5 with 5.7 updated.   I use windows.  My problem is with the spot healer or remover.  It worked perfectly when I click on it it don't have the additional circle with a line attached to it where I can move it to another place for better sa

    I have lightroom 5 with 5.7 verson updated.  I use windows.  My problem is with the spot healer or remover in the develop.  It worked perfectly for a while and then suddenly the other circle with a line attached to it where you can move it to a better spot stopped showing up.  I uninstalled the software and re installed it again but it didn't fix the problem and its still the same.  Help please.

    Does the iPod work OK?
    Does it charge when connect to the computer?
    Does it appear in My Computer?
    Look at the dock connector on the iPod. Compare with the iPod that does work/connect.
    I suspect you have a 2G iPod. Those can only go to iOS 4.2.1
    http://support.apple.com/kb/HT1353#iPod_touch_late2009
    iPod touch (3rd generation)
    iPod touch (3rd generation) features a 3.5-inch (diagonal) widescreen multi-touch display and 32 GB or 64 GB flash drive. You can browse the web with Safari and watch YouTube videos with Wi-Fi. You can also search, preview, and buy songs from the iTunes Wi-Fi Music Store on iPod touch.
    The iPod touch (3rd generation) can be distinguished from iPod touch (2nd generation) by looking at the back of the device. In the text below the engraving, look for the model number. iPod touch (2nd generation) is model A1288, and iPod touch (3rd generation) is model A1318.

  • 4S ios updated to 7 is giving me problems for using wifi Thus it is difficult for me to use internet. The wifi comes on for a while and goes off in a few minutes The phone is unable to scan networks available for use

    4S ios updated to 7 is giving me problems for using wifi Thus it is difficult for me to use internet. The wifi comes ON for a while and goes off in a few minutes The phone is unable to scan networks available for use
    Am having ipad2, ipad mini and iphone 4 with family of two persons. One hp laptop and a DELL professional computer also in operation
    Myself an engineer for projects
    Looks the company apple cannot grow if they do not support solving the problems of their existing customers
    Ashok Dhingra
    India

    You are not addressing Apple here. If you have a problem, describe it and someone might be able to help. Just to be sure, the wi-fi on the phone will go off after the phone goes into sleep mode unless it is actively being used. This is a battery saving measure. If you are actively using the internet, and the phone is still awake, then the wi-fi should remain connected.
    What troubleshooting steps have you tried.

  • I want to make a chatroom using jsp, and have some problem, Help!

    I want to build a chatroom using jsp and client using plain html, so i need every client could have a constant connection with the web server and will receive messages realtime. But i got 2 problems.
    First, how can i turn my buffers off so that messages can get to the client the time it is meant to be. I added
    <@page buffer="none">
    but seems that it takes no effect, any tricks here? thx
    Second, I want every user could have a constant conn. with server but i dont want my server to waste resources on those connection that has already been disconnected.so is it possible to stop executing JSP pages once client has diconnected.Since i found that it will throw no exception writing to the client even if the connection is disconnected in JSPs.
    Thanks!!!!!

    By theway, i'm using TOMCat 5.0 as my JSP container.

  • Previously i use ios 4 version 4.2.1 then i updated to 4.3.3 the problem is my network coverage sometimes not in service or no network?now i update to ios 5 its still happend?can advice me..

    Previously i use ios 4 version 4.2.1 then i updated to 4.3.3 the problem is my network coverage sometimes not in service or no network?now i update to ios 5 its still happend?can advice me..

    Scroll down and see the "Update Your Device Using iTunes" section here:
    HT4623
    There is no "update icon" in iOS versions earlier than iOS 5.
    The update is very large (over 1.2 gigabytes).  You need a good internet connection to download it to your computer.  Maybe you'll need to take a trip to a city to get a good enough connection.

  • Problem using jsp:include from inside a custom tag

    Hi, All !
              I have a problem using <jsp:include> from inside a custom tag. Exception is:
              "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              could not do this. Is it a bug, since in the 1.1 spec is said: "The
              BodyContent is a subclass of JspWriter that can be used to process body
              evaluations so they can retrieved later on."
              My code is:
              <wfmklist:items>
              <jsp:include page="item.jsp" flush="true"/>
              </wfmklist:items>
              

    This is an area of contention with WL. It is not so tolerant with regards to
              the spec. I spent several days recently trying to convince it to accept the
              specification in regards to bodies and includes and it appears to have
              successfully rebuffed my efforts.
              Frankly, this is very disappointing. It appears that some shortcuts were
              taken on the way to JSP 1.1 support, and the result is a very hard-coded,
              inflexible implementation. As I have not seen the implementation myself, I
              hate to assume this, however one could posit that the term "interface" was a
              foreign concept during the implementation, other than as some annoying
              intermediary reference requiring an immediate cast to a specific Weblogic
              class, which in turn is apparently required to be final or have many final
              methods, as if being optimized for a JDK 1.02 JIT.
              I am sorry that I don't have any positive suggestions other than to use a
              URL object to come back in an execute the necessary "include" directly. You
              lose all context (other than session) and that can cause its own problems.
              However, you can generally get the URL approach to work, and you will
              hopefully avoid further frustration.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              Tangosol: How Weblogic applications are customized
              "Denis" <[email protected]> wrote in message
              news:[email protected]...
              > Hi, All !
              > I have a problem using <jsp:include> from inside a custom tag. Exception
              is:
              > "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              >
              > Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              > could not do this. Is it a bug, since in the 1.1 spec is said: "The
              > BodyContent is a subclass of JspWriter that can be used to process body
              > evaluations so they can retrieved later on."
              >
              > My code is:
              > ...
              > <wfmklist:items>
              > <jsp:include page="item.jsp" flush="true"/>
              > </wfmklist:items>
              > ...
              

  • Problem using jsp:forward in java script

    hi,
    when I use jsp forward tag inside java script i'm getting a problem that
    when the jsp is invoked it is getting forwarded to the page specified in the forward tag, without checking the if conditions. Following code may give you a better idea.
    <html>
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    <jsp:forward page="success.jsp" />
    </script>
    <body>
    <form name="f" method=post>
    <input type=text name=htemp value="true">
    <input type=button onclick="test()">
    </form>
    </body>
    </html>
    please help me,thanks inadvance
    regards
    chandu

    What pgeuens means is that you can't mix javascript and jsp/java code in this way.
    ALL of the jsp/java code gets executed at the server end.
    This produces an HTML page (with embedded javascript) which gets sent to the client.
    The client then runs javascript code in response to events (onLoad, onClick, onChange etc etc)
    So in this case, the jsp:forward will always be executed, because as far as the server is concerned, the javascript is just template text.
    If you WANT to do a conditional forwarding on the server side you do it in java ie (horribly using scriptlet)
    <%
    if (testCondition){
    %>
      <jsp:forward>
    %<
    %>Or if you want to test what the client has entered client side, all you can do is submit the form, or navigate to a URL
    <script>
    function test()
    if(document.f.htemp.value=="true")
    alert("jus");
    else
    var s=document.f.htemp.value;
    alert(s);
    document.f1.action="success.jsp";
    document.f.submit();
    </script>You cannot run JSP code based on your javascript code.
    Java. Javascript. Not the same thing.
    Hope this helps,
    evnafets

  • Problem with database using JSP

    Hi
    i am developing one application which uses JSP ..to connect to the database..at present i am using MS-access for the data storage...
    I have two pages in one page there is a form where user fills all the details and once submit the information based on the form has to fetch the data from the backend...i have a problem ..if i hard code the corresponding column name in the JSP page it is getting all the data but if i get it from request.getParameter("")( which i am supposed to be from the form) i am getting no records..
    take a look at the code below and let me know...
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    java.sql.Connection conn= java.sql.DriverManager.getConnection("jdbc:odbc:asiafinity");
    java.sql.Statement stmt=conn.createStatement();
    /* If i print a value from the previous pages its showing but its not going to the database with query statement..
    // String str1=request.getParameter("religion");
    // System.out.println(str1);
    /* If i hardcode the corresponding columun data its querrying the data
    String str1="hindu";
    String sqlquery="select * from userprofile where religion='"+str1+"'";
    System.out.println(str1);
    java.sql.ResultSet cols=stmt.executeQuery(sqlquery);
         while(cols.next()){
    String gen=cols.getString("gender");
    String age=cols.getString("age");
    String rel=cols.getString("religion");
    String cul=cols.getString("culture");
    String loc=cols.getString("location");
    String pro=cols.getString("profession");
    String uname=cols.getString("username"); %>
    <tr><td><a href="<%=uname%>"><%=uname%></td>
    <td><%= gen %></td>
    <td><%= age %> </td>
    <td><%= rel %> </td>
    <td><%= cul %> </td>
    <td><%= loc %></td>
    <td><%= pro %></td>
    </tr>
              <% } %>
    Please help me out..i know this is an simple problem
    Thanks & Regards
    Gnanesh
    </a>

    String str1=request.getParameter("religion");
    String sqlquery="select * from userprofile where religion='"+str1+"'";
    System.out.println(sqlquery);
    try it and tell me what happens

  • A wierd problem after updating my skype

    i not know if this is the good place to post it but if its wrong please move it to the good place.
    after updating my skype to the new version from skype i got this message message from it and its telling me that i cant see my facebook friends message and tell me that i most download the newst versoin from skype after updating it to the new version.
    my version from skype is: 6.7.0.102
    that most be the last version from skype so far
    can somebody help me maybe to fix this problem?

    You may need temporary to disable AVG when installing the new Skype update or configure this Antivirus to allow Skype.
    Alternatively, you can use this method.
    Download, but don’t run this installer for the latest 6.9.0.106 version.
    http://download.skype.com/msi/SkypeSetup_6.9.0.106.msi
    Using the procedure described here,
    http://community.skype.com/t5/Windows/How-to-update-Skype-without-using-any-Skype-installer/m-p/7073...
    extract the Skype.exe file from the SkypeSetup_6.9.0.106.msi file and replace your currently installed Skype.exe with this new Skype.exe file. You will be now running the Skype 6.9.0.106 version.

  • When I load cds i get a message that states, "User not registered for online use." This problem has only begun since the new itunes update and is only a problem on my pc laptop.  Media content (track names, etc.) do not load.  Thanks

    When I load cds i get a message that states, "User not registered for online use." This problem has only begun since the new itunes update and is only a problem on my pc laptop.  Media content (track names, etc.) do not load.  Thanks

    See  Re: itunes 12 track names not found and user not registered for online use.
    tt2

  • Problem while updating Item category using Bapi_salesorder_change

    Hi,
    Iam facing a probelm while updating item category using bapi Bapi_salesorder_change
    In the Return table iam getting the folowing mesages.
    Inforation mesage : Field 'PSTYV' cannot be changed, VBAPKOM 000010  ready for input
    Error Message : Item 000010 cannot be processed.
    Please find the code below
    CLEAR wa_bapisdh1x.
      wa_bapisdh1x-updateflag = 'U'.
      CLEAR wa_order_item_inx.
      wa_order_item_inx-itm_number = wa_vbap-posnr.
      wa_order_item_inx-item_categ = 'X'.
      wa_order_item_inx-UPDATEFLAG = 'U'.
      APPEND  wa_order_item_inx TO it_order_item_inx.
      CLEAR wa_order_item_inx.
      CLEAR wa_order_item_in.
      wa_order_item_in-itm_number = wa_vbap-posnr.
      wa_order_item_in-item_categ = 'ABC'.
      APPEND wa_order_item_in TO it_order_item_in.
      CLEAR wa_order_item_in.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = w_vbeln
          order_header_inx = wa_bapisdh1x
        TABLES
          return           = it_return
          order_item_in    = it_order_item_in
          order_item_inx   = it_order_item_inx
    How can i correct it..
    Regards
    Kumar

    Actually iam facing a strange problem here.
    When i copy the program into another sample program and execute it iam able to change both the item catgegory and delivery block for particular sales order and item number.
    But in my main program i have BDC for MB1B transaction to create the material document.
    Once the material document is created succesfully iam using BAPI Sales_order_change to change the item category and delivery block..
    In my main program iam not to change the item catgeory getting an error field PSTYV cannot be changed.
    But the same code is running percfectly in the copied one..
    How can i correct that..
    Regards
    Kumar

Maybe you are looking for

  • File at a location

    Hi all, Can I copy a file from one folder to other folder and delete this file from the first folder using abap? For example there is a folder at C:\Etc\Test and I want to copy this file to folder xyz as: C:\XYZ\Test How can I do that and delete the

  • Create outgoing SSL connections in WebLogic 4.5.1 using JSSE

    Hi, Does anyone know how to create outgoing SSL connections from a WLS 4.5.1 using JSSE. I've implemented an application using JSSE for POSTing data to an HTTPS server that requires client authentication and it worked fine. But when used inside the W

  • ChaRM and satellite refresh

    Hello Gurus, We have implemented and use ChaRM for our landscape : DEV->QAS->INT->PROD since 10 days. We are making 1 time/month a copy refresh from our PROD to the INT system. I wonder what's going on ChaRM for all the current transport requests bef

  • Regarding keyfield value in payload

    Hi from the sender side I am receiving a flat file with header, body,trailer. In the payload I don't have keyfied . can any one suggest me how to configure in content conversion parameters in the sender file adapter. Thanks & Regards venkat.

  • In future batches are maintained in plant level

    dear all, when i am doing MB1A ,MB1B,MB1C  after i save the document there is a message saying that in future the batches are maintained at plant level. I am not getting the document generated number. because of this i am unable to find whether the d