Where is the errors in this statement?

stat.executeUpdate("insert into message("+"'login,destinateur,message'"+") values("+"'"+log+"','"+destinateur+"','"+message+")");

stat.executeUpdate("insert into
message("+"'login,destinateur,message'"+")
values("+"'"+log+"','"+destinateur+"','"+message+")");I notice two problems.
1) in your field list your string will look like ('login,destinateur,message'). You need to get rid of the single quotes around the field names.
2) You are missing a single quote after message at the end of the string: ...+message+")" instead of ...+message+"')"
SQL statements tend to be somewhat difficult to debug. To help you might want to split them into two statements:
String sql = "insert into...";
stat.executeUpdate(sql);
Then you can use a debugger (or insert a System.out.println) to see what the value of sql is before the statement is executed. Its easier to notice those little problems when you are seeing the final string with all of its values inserted.

Similar Messages

  • Where is the error in this statement?

    stat.executeUpdate("insert into message("+"'login,destinateur,message'"+") values("+"'"+log+"','"+destinateur+"','"+message+")");

    stat.executeUpdate("insert into
    message("+"'login,destinateur,message'"+")
    values("+"'"+log+"','"+destinateur+"','"+message+")");
    stat.executeUpdate(
        insert into message(
      +
          login,destinateur,message
      +
        values(
      +
      + log +
      + destinateur +
      + message +
    );What is the problem with it?

  • Where's the error in this code...

    the following snippet of code throws a SQLException with a 'Invalid Handle' message.
    What's does this 'Invalid Handle' mean? And, which line of code is causing the problem?
    try {
    //RETRIEVE CITYLIST FROM DB
    cityList = statement.executeQuery("SELECT CityCode, CityName FROM CityList");
    while (cityList.next()) {
    //ADD CODES AND NAMES OF CITIES TO ARRAYLISTS
    String code = cityList.getString(1);
    String name = cityList.getString(2);
    codes.add(code);
    names.add(name);
    cityList.close();
    } catch (SQLException sql) {
    System.out.println("2-checkForAvailability.jsp..err->" + sql);
    Any help will be appreciated..
    regards
    Ushanta

    Yes, you don't declare the ResultSet inside that try block, so I'll assume that it's a data member of your class. I'd suggest that you make the ResultSet a local variable in that method and not try to hang onto it. Same for the statement:
    Statement statement = null;
    ResultSet cityList = null;
    try
    statement = connection.createStatement();
    cityList = statement.executeQuery("SELECT CityCode, CityName FROM CityList");
    while (cityList.next())
        String code = cityList.getString(1);
        String name = cityList.getString(2);
        codes.add(code);
        names.add(name);
    } catch (SQLException sql)
        sql.printStackTrace();
        System.err.println("SQL state: " + sql.getSQLState());
         System.err.println("SQL error: " + sql.getErrorCode());
    finally
        try
            if (cityList != null)
                cityList.close();
            if (statement != null)
                statement.close();
        catch (SQLException ignoreException)

  • Could anyone tell me where is the error in this code

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js"></script>
    <script src="js/AddRemRows.js" type="text/javascript"></script>
    <script type="text/javascript">
        function doAdd(ths)
        var x = $(this).closest('tr').find('input.x').val();
        var y = $(this).closest('tr').find('input.y').val();
        y=x;
    </script>
    <body>
    <table width="411" height="64" border="1" cellpadding="0" cellspacing="0" id="myTable">
        <tr>
            <td width="43%">Y</td>
            <td width="57%">X</td>
        </tr>
        <tr>
          <td width="43%"><select class="y" name="y" id="y" onchange="doAdd(this)">
              <option value="0">0 </option>
              <option value="1">1</option>
              <option value="2">2</option>
            </select></td>
            <td><input class="x" type="text" name="x" id="x" /></td>
        </tr>
    </table>
    <p>
      <input name="addrow" type="button" id="addrow" onclick="addRow('myTable')" value="add" />
    </p>
    </body>
    </html>

    If you format the source code properly you will be able to see what has gone wrong
    <!doctype html>
    <html>
    <head>
    <script>
    function addRow(tableID) {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);
        var colCount = table.rows[0].cells.length;
        for(var i=0; i<colCount; i++ ) {
            var newcell = row.insertCell(i);
            newcell.innerHTML = table.rows[1].cells[i].innerHTML;
            switch(newcell.childNodes[0].type) {
                case "text":
                    newcell.childNodes[0].value = "";
                    break;
                case "checkbox":
                    newcell.childNodes[0].checked = false;
                    break;
                case "select-one":
                    newcell.childNodes[0].selectedIndex = 0;
                    break;
    function deleteRow(tableID) {
        try {var table = document.getElementById(tableID);
            var rowCount = table.rows.length;
            for(var i=0; i<rowCount; i++) {
                var row = table.rows[i];
                var chkbox = row.cells[0].childNodes[0];
                if(null != chkbox && true == chkbox.checked) {
                    if(rowCount <= 2) {
                        alert("Cannot delete all the rows.");
                        break;
                    table.deleteRow(i);
                    rowCount--;
                    i--;
        catch(e) {
            alert(e);
    function kk(){
        var table = document.getElementById("datatable");
        var rowCount = table.rows.length;
        for(var i=0; i<rowCount; i++)
            var x =row.cells[i].childNodes[i];
            var s1 = document.getElementById("s1").value;
            var txt1 = document.getElementById("txt1").value;
            txt1[rowCount] = s1[rowCount];
    </script>
    </head>
    <body>
    <input type="button" value="Add Row" onClick="addRow('datatable')" />
    <input type="button" value="Delete Row" onClick="deleteRow('datatable')" />
    <table width="369" height="63" border="1" id="datatable">
        <tr>
            <td width="32"></td>
            <td width="119" align="center"><strong>Activity</strong></td>
            <td width="177" align="center"><strong>Cost</strong></td>
        </tr>
        <tr>
            <td><input type="checkbox" name="chk"/></td>
            <td><select name="s1" id="s1" onChange="kk();">
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select></td>
            <td><input type="text" name="txt1" id="txt1"></td>
        </tr>
    </table>
    </body>
    </html>
    In function kk(), the for loop does not have an opening and closing curly bracket.
    When I add two more rows, the resulting markup is as in
    <table id="datatable" border="1" height="63" width="369">
        <tbody>
            <tr>
                <td width="32"></td>
                <td align="center" width="119"><strong>Activity</strong></td>
                <td align="center" width="177"><strong>Cost</strong></td>
            </tr>
            <tr>
                <td><input name="chk" type="checkbox"></td>
                <td><select name="s1" id="s1" onchange="kk();">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                    </select></td>
                <td><input name="txt1" id="txt1" type="text"></td>
            </tr>
            <tr>
                <td><input name="chk" type="checkbox"></td>
                <td><select name="s1" id="s1" onchange="kk();">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                    </select></td>
                <td><input name="txt1" id="txt1" type="text"></td>
            </tr>
            <tr>
                <td><input name="chk" type="checkbox"></td>
                <td><select name="s1" id="s1" onchange="kk();">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                    </select></td>
                <td><input name="txt1" id="txt1" type="text"></td>
            </tr>
        </tbody>
    </table>
    In the above you will notice that the values for name and id are repeated. This is not only illegal, but is very confusing for the kk() function as it does not know which value it is that you want.
    My advice is to change the addrow() and deleterow() functions to allow for unique names and id's. Once you have done that, it is easy to allocate the values for the textbox.

  • Wher's the error? BPPF-BLART IN TD_PROTOCOLLO AND SYST-TCODE NOT IN Z_ECCEZ

    Hi All,
    cuold anyone tell me wher's the error in this code I've used in validation rules of FI?
    BPPF-BLART IN TD_PROTOCOLLO AND SYST-TCODE NOT IN Z_ECCEZIONE
    Thanks

    Hi All,
    cuold anyone tell me wher's the error in this code I've used in validation rules of FI?
    BPPF-BLART IN TD_PROTOCOLLO AND SYST-TCODE NOT IN Z_ECCEZIONE
    Thanks

  • Where's the error

    hey all, plz if any one can tell me where is the error in this method, its giving me arrayOutOfBounds error:
              for(int i=0; i<arr.length; i++)
                   if(arr[i+1] == arr)
                   result += arr[i]+arr[i+1];
                   if(result > maxResult)
                   maxResult = result;
              System.out.println(maxResult);
    thanks alot
    Abed

    Stop the loop one iteration earlier.
    By the way, both the API description and the error message, as well as the stack trace of an AAIOBE are very obvious and straightforward in pointing out the error's cause.

  • HT204053 I am running Windows 7 and have tried to install iCloud.  No matter what instructions I follow, I still get the error message "This Apple ID is valed but is not an iCloud account."  How can I resolved this?

    I am running Windows 7 and have tried to install iCloud.  No matter what instructions I follow, I still get the error message "This Apple ID is valed but is not an iCloud account."  How can I resolved this?

    I've tried both. First, I tried on my pc, where iTunes had installed iCloud when it last updated. I have iTunes installed on this computer (and on my iPad and iPhone), but that wasn't the issue.
    So I went online, thinking I needed a separate iCloud Apple ID, but it prompted me for my current Apple ID and gave me the message about my ID being "valid" but not an iCloud account," which, lol, was what it had asked me to do in order to create one. I checked, and at least one other user is having the same issue. I'll attempt to copy/paste the Support request url: https://discussions.apple.com/thread/4430653?tstart=0
    Thank you for any help you can give.
    Trish

  • Where is the error ring constant in LV 8.2?

    Where is the Error Ring Constant in LabView 8.2?  It was in the block diagram numerics panel in 7.1.1.

    You might wish to have a look at this.
    Try to take over the world!

  • Where is the Error? in JSP

    I have develpoed a small application in java. which contains on one servler and one jsp page.
    Here is the servlet code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class Controller extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html";
    //Initialize global variables
    public void init() throws ServletException {
    //Process the HTTP Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    // PrintWriter out = response.getWriter();
    String teststring = "Good";
    request.setAttribute("Noman", teststring);
    RequestDispatcher reqdispatcher = this.getServletConfig().getServletContext().getRequestDispatcher("model1.jsp");
    reqdispatcher.forward(request,response);
    //Clean up resources
    public void destroy() {
    and here is the jsp page code:
    <html>
    <head>
    <title>
    model1
    </title>
    </head>
    <body bgcolor="#ffffff">
    <!--<form method="GET" action="Controller">
    JBuilder Generated JSP
    </form><-->
    <% String a = (String)request.getAttribute("Noman"); %>
    <%= a %>
    </body>
    </html>
    I want to pass a string drom servlet to jsp page.
    but when i run the jsp page. it displays null value in string.
    Where is the error.
    i tried it a lot but can not find error in code.
    plz help me.
    Thanks
    Nomi

    i have passed the URL of servlet to run then it shows that error
    Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Errortype Exception reportmessage Internal Server Errordescription The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.exception java.lang.IllegalArgumentException: Path model1.jsp does not start with a "/" character
    at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:572)
    at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:174)
    at test.Controller.doGet(Controller.java:21)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
    at java.lang.Thread.run(Thread.java:534)
    i have not wrote any "/" character . i dont know what is that ?

  • Why now do I get the error message that states Firefox can't find the server at ......

    Majority of times when I search for a particular web site I get the error message that states that "Firefox cannot find the server at ... " (site I am looking for)

    I still have the problem although I uninstalled Mozilla (clearing the cache didn't work and neither did Word diagnostics), so have ended up thinking it could be Norton (the manual update worked x1) or Windows. Today I found an answer: disable the preview pane in Windows Explorer - there's a history of problems with this view.

  • In iCal - I keep getting the error message " This calendar was created by Mail" and it will not accept any input; why..??

    In iCal - I keep getting the error message “ This calendar was created by Mail” and it will not accept any input; why..??

    use Disk Utility and Verify Permisions then fix and Verify Disk and fix, this should fix it.

  • I have just purchased a lightning to 30 pin adaptor to use on an iPad mini and a gen5 iPod touch both devices are running iOS 8.1.3 and come up with The error message "this accessory is not supported by this device "

    I have just purchased a lightning to 30 pin adaptor to use on an iPad mini and a gen5 iPod touch both devices are running iOS 8.1.3 and come up with The error message "this accessory is not supported by this device "
    THis is means they are not charging on a 30 pin cable and the touch won't work in my Apple iPod dock - no audio out or charge. Have re powered both devices to no avail am wondering if the iOS version is the problem
    Help!

    If it is a lightning to 30 pin adaptor, and you have a 7th Generation Nano it has to fit the Nano.
    This is lightning to 30 pin adapter: http://www.bestbuy.com/site/Apple%26%23174%3B---Lightning-to-30-Pin-Adapter/6651 936.p?id=1218803450821&skuId=6651936#tab=overview
    Is this what you bought?
    You need to contact Sony and see if they model you have is compatible with the docking adapter. It may not be.

  • I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version.  How do I update my PHONE and why is an itunes update being confused for my iphone?

    I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version.  How do I update my PHONE and why is an itunes update being confused for my iphone?

    You need iTunes 10.0 or greater to update your phone...iTunes isn't confused at all. If you're on a Mac, you'll need OS X 10.5.8 or greater to update iTunes to 10.0 or greater.

  • I, work on dell laptop latitudes version 7, win 7 64 bit, ssd disk, 16 gb ram. i receive the error 12 This device cannot find enough free resources that it can use. please help

    I, work on dell laptop latitudes version 7, win 7 64 bit, ssd disk, 16 gb ram.
    i receive the error 12 This device cannot find enough free resources that it can use. please help

    1. You have placed problem in wrong forum, or use different Windows operating system
    2. Double check your resources, namely in Disk manager. What is free space on HDD?
    Regards
    Milos

  • Excel 2010: I get the error message "This file can't be previewed because of an error in the Microsoft Excel previewer." even though Advanced Properties is set to Save Thumbnails for all Excel Documents.

    Excel 2010: I get the error message "This file can't be previewed because of an error in the Microsoft Excel previewer." even though Advanced Properties is set to Save Thumbnails for all Excel Documents and I've run Repair on Microsoft Office.
     I don't know what else to try.
    Any help would be appreciated. Thanks.

    A hotfix request has already been submitted for this issue and we have also documented it here
    http://support.microsoft.com/kb/983097
    Thanks.
    Tony Chen
    TechNet Community Support

Maybe you are looking for

  • Display month name in DateField control

    I'm using the MX DateField control in Flex and want to display the date  as 01 Jul 2011 or 01 July 2011. Does anyone know how to do this? I tried  setting the formatString to "DD MMM YYYY" but it didn't work.

  • Is window 8 to blame for me not being able to sync my ipod?

    I just upgraded my computer and it is Windows 8 operating system. My ipod will no longer sync from itunes. Is there a driver I need to download for itunes to get this to work?

  • Help with my 20g 4th gen ipod

    I haven't used this ipod in a while because it had a sad face. But all of a sudden it came back to life but I just tried connecting it to mbp and it won't respond with itunes. Itunes actually stops responding but the ipod still says "Do no disconnect

  • Using dynamic values in the IN clause

    hey guys , is it possible to use dynamic values for comparing in the IN clause while writting query in views, in adf bc .

  • Track ball is toast

    Like most of you my trackball has stopped scrolling down, this times I fear its for good. Is there anyway to sign a button to scroll down like the old blackberries used to do? I'd love to be able to use my volume up and down buttons for this. Thanks