Sql exception :too few paprameters to update

I am getting an sql exception in this query below.
It says too few parameters :expected 1
String query = "UPDATE INR SET " + month+ " = " + mnt+ " where (IT = '" + initial + "') AND (new = '" + later+ "' ) AND (number = '" + num + "' ) AND (code = '" + Id + "')";
I am just passing 1 telling it to update month column with mnt .
Thanks,

Here is my code with JDBC connecting to an Access Table
String data ="jdbc:odbc:MonthUpdateTable";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");     
     Connection conn = DriverManager.getConnection(data, "", "");
     Statement st = conn.createStatement();
     String query = "UPDATE INR SET " + month+ " = " + mnt+ " where (IT = '" + initial + "') AND (new1 = '" + later+ "' ) AND (number = '" + num + "' ) AND (code = '" + Id + "')";
     System.out.println(query);
     st.executeUpdate(query);
     st.close();
          conn.close();
catch(Exception e) {System.out.println("UpdateError: " + e.toString()
           + e.getMessage());}
Thanks,

Similar Messages

  • Pls help for Exception "Too Few Parameters : Expected 35"

    Hi,
    I am expericing with the exception
    "Too Few Parameters : Expected 35".
    What's wrong with it? The following is my code.
    try {                                                                                                                                                                                                                
    String DRIVER = ("sun.jdbc.odbc.JdbcOdbcDriver");               
    String URL = "jdbc:odbc:Industrial_One_DSN";
    String sql = "UPDATE BusinessRegistration " +
    "SET [Date] = ?, ISIC = ?, BizName = ?, BizAddress = ?, " +
    "OwnerName = ?, OwnerNRC = ?, Investment = ?, EstablishedYear = ?, " +
    "L_Male = ?, L_Female = ?, F_Male = ?, F_Female = ?, " +
    "OwnershipType = ?, Remarks = ?, IndustialZoneName = ?, Unit = ?, " +
    "Fuel = ?, FactoryType = ?, FactoryName = ?, Township = ? " +
    "MainProductName = ?, MainProductCountType = ?, " +
    "MainProductQuantity = ?, MainProductValue = ?, RMName = ?, " +
    "RMCountType = ?, RMQuantity = ?, RMValue = ?, EnergyName = ?, " +
    "MachinePower = ?, AmountGallon = ?, StateDiv = ?, BizSize = ?  " +
    "WHERE RegistrationID = ?";
    Class.forName(DRIVER);
    Connection con = DriverManager.getConnection(URL);
    PreparedStatement pstmt = con.prepareStatement(sql);
    int ilmale = Integer.parseInt(lmale);
    int ilfemale = Integer.parseInt(lfemale);
    int ifmale = Integer.parseInt(fmale);
    int iffemale = Integer.parseInt(ffemale);
    int impq = Integer.parseInt(mpq);
    int impv = Integer.parseInt(mpv);
    int irmq = Integer.parseInt(rmq);
    int irmv = Integer.parseInt(rmv);
    int iamountgallon = Integer.parseInt(amountgallon);
    pstmt.setString(1, date);
    pstmt.setString(2, isic);
    pstmt.setString(3, bizname);
    pstmt.setString(4, bizaddress);
    pstmt.setString(5, ownername);
    pstmt.setString(6, ownernrc);
    pstmt.setString(7, investment);
    pstmt.setString(8, eyear);
    pstmt.setInt(9, ilmale);
    pstmt.setInt(10, ilfemale);
    pstmt.setInt(11, ifmale);
    pstmt.setInt(12, iffemale);
    pstmt.setString(13, ownershiptype);
    pstmt.setString(14, remark);
    pstmt.setString(15, izn);
    pstmt.setString(16, unit);
    pstmt.setString(17, fuel);
    pstmt.setString(18, ft);
    pstmt.setString(19, fname);
    pstmt.setString(20, township);
    pstmt.setString(21, mpn);
    pstmt.setString(22, mpct);
    pstmt.setInt(23, impq);               
    pstmt.setInt(24, impv);
    pstmt.setString(25, rmname);
    pstmt.setString(26, rmct);
    pstmt.setInt(27, irmq);
    pstmt.setInt(28, irmv);
    pstmt.setString(29, ename);
    pstmt.setString(30, mpower);
    pstmt.setInt(31, iamountgallon);
    pstmt.setString(32, statediv);
    pstmt.setString(33, bizsize);
    pstmt.setInt(34, Integer.parseInt(rid));
    pstmt.executeUpdate();
    }I have got 35 fields in my db. But I wanna edit 34 fields only. I have no primary key in my table. Is't alright?
    pls help me.
    With thanks,
    WTDAHL

    I presume you are using SQL server, hence the [Date] in your SQL?
    I counted 34 question marks in your SQL statement, And 34 parameters supplied.
    Looks ok to me.
    You say you have no primary key? What is RegistrationId then?
    My suggestion for debugging: start smaller.
    Try updating it with only 5 fields, then 10 then 15 and build it up like that.
    Trying to debug 35 fields is a nightmare - you have to break it down to solve it.
    Good luck,
    evnafets

  • What does this SQL Exception mean?

    Well I told you guys I'd be back with more questions. The database is now connected and my add User feature is working fine. I am however, receiving an SQL Exception when I try to update or delete. Here's the exception:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6183)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2489)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:329)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:279)
         at UserDM.updateUser(UserDM.java:187)
         at User.updateUser(User.java:271)
         at UserUI.invokeUpdate(UserUI.java:296)
         at UserUI.actionPerformed(UserUI.java:236)
         at java.awt.Button.processActionEvent(Button.java:324)
         at java.awt.Button.processEvent(Button.java:297)
         at java.awt.Component.dispatchEventImpl(Component.java:2588)
         at java.awt.Component.dispatchEvent(Component.java:2492)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)
    java.sql.SQLException: Invalid handle
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6198)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2489)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:329)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:244)
         at UserDM.populateUser(UserDM.java:130)
         at User.buildUserVector(User.java:301)
         at User.updateUser(User.java:277)
         at UserUI.invokeUpdate(UserUI.java:296)
         at UserUI.actionPerformed(UserUI.java:236)
         at java.awt.Button.processActionEvent(Button.java:324)
         at java.awt.Button.processEvent(Button.java:297)
         at java.awt.Component.dispatchEventImpl(Component.java:2588)
         at java.awt.Component.dispatchEvent(Component.java:2492)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)Here is the method:
         // method to update info for a user in the database
        public static void updateUser(User aUser) throws SQLException
            String query1 = "UPDATE Users SET LastName = " + "'" + aUser.getUserLastName() + "'" + " WHERE Alias = " + aUser.getUserAlias();
              String query2 = "UPDATE Users SET FirstName = " + "'" + aUser.getUserFirstName() + "'" + " WHERE Alias = " + aUser.getUserAlias();
              String query3 = "UPDATE Users SET MiddleInitial = " + "'" + aUser.getUserMiddleInitial() + "'" + " WHERE Alias = " + aUser.getUserAlias();
              String query4 = "UPDATE Users SET Alias = " + "'" + aUser.getUserAlias() + "'" + " WHERE Alias = " + aUser.getUserAlias();
              String query5 = "UPDATE Users SET Password = " + "'" + aUser.getUserPassword() + "'" + " WHERE Alias = " + aUser.getUserAlias();
              String query6 = "UPDATE Users SET Role = " + "'" + aUser.getUserRole() + "'" + " WHERE Alias = " + aUser.getUserAlias();
              String query7 = "UPDATE Users SET Rights = " + "'" + aUser.getUserType() + "'" + " WHERE Alias = " + aUser.getUserAlias();
            Statement statement = connection.createStatement();
              statement.executeUpdate(query1);
            statement.executeUpdate(query2);
            statement.executeUpdate(query3);
            statement.executeUpdate(query4);
            statement.executeUpdate(query5);
            statement.executeUpdate(query6);
            statement.executeUpdate(query7);
              userList.removeAll();
               if( userRS !=null)
               while( userRS.next() )
                         aLastName = userRS.getString(1);
                         userList.add(aLastName);
            statement.close();
              close();
              open();
        }The reason for the multiple queries is that it's just easier with my editor than trying to concatenate to new lines. I still get the same exception with just one query.
    Thanks,
    Shawn

    I changed it to the prepared statement. As for the question about the Alias, I don't know why that would have to be in parentheses since it's a field in the table. I double checked all the table and field names with the one in the code, they are in sync. Here's my new method:
         // method to update info for a user in the database
        public static void updateUser(User aUser) throws SQLException
         String preparedSQL = "UPDATE Users SET " +
                                   "LastName = ?, FirstName = ?, MiddleInitial = ?, Alias = ?, Password = ?, Role = ?, Rights = ?" +
                                  "WHERE Alias = ?";
         PreparedStatement ps = connection.prepareStatement(preparedSQL);
         ps.setString(1, aUser.getUserLastName());
         ps.setString(2, aUser.getUserFirstName());
         ps.setString(3, aUser.getUserMiddleInitial());
         ps.setString(4, aUser.getUserAlias());
         ps.setString(5, aUser.getUserPassword());
         ps.setString(6, aUser.getUserRole());
         ps.setString(7, aUser.getUserType());
         ps.setString(8, aUser.getUserAlias());
         ps.executeUpdate();
    }Here are the exceptions I'm getting now:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
    java.sql.SQLException: Invalid handle
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Pa_RaM006WHERE Alias = Pa_RaM007'.
    java.sql.SQLException: Invalid handle
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Pa_RaM006WHERE Alias = Pa_RaM007'.
    java.sql.SQLException: Invalid handle
    java.lang.ArrayIndexOutOfBoundsException: 7
    java.sql.SQLException: Invalid handle
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Pa_RaM006WHERE Alias = Pa_RaM007'.
    java.sql.SQLException: Invalid handleWhat could the missing operator be for the Alias? I've tried using the message aUser.getUserAlias instead of the ?, but it gives the same exception.
    I do not have it set up for CONCUR_UPDATABLE, it that necessary for this application? I also heard that a permission statement is supposed to be added to the java.policy file, any input on this?
    Thanks!
    Shawn

  • Java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few pa

    I have 2 tables in my database as:
    db3
    Code | number primary key
    name | text
    priceperqty | number
    avail1 | number
    tempupdate
    transactedvalue | number
    Code | number foreign key
    I run following code:
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection(
    "jdbc:odbc:inven");
    Statement stmt = con.createStatement(
    ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    stmt.setFetchSize(35);
    ResultSet rs1=stmt.executeQuery("Select avail1,transactedvalue from db3,tempupdate where db3.code=tempupdate.code");
    while(rs1.next())
    //subtracting available value - transacted value
    int a =rs1.getInt(1);
    int b =rs1.getInt(2);
    int c=b-a;
    int d=-(c);
    //storing results into an array
    for(int i=0;i<4;i++)
    y=d;
    i++;
    //printing on console
    System.out.println(""+a);
    System.out.println(""+b);
    System.out.println(""+d);
    //updating available values in table db3
    for(int i=0;i<4;i++)
    stmt.execute("update db3 set avail1="+y[i]+" where db3.Code=tempupdate.Code="+(i+1)+"");
    catch (Exception ex)
    ex.printStackTrace();
    Why does avail1 attribute does not show any updations and throws exception of too few parameters?can anyone help me?
    Edited by: Peter1 on Jul 2, 2008 4:39 AM

    zhaoyh wrote:
    tmt.execute("update db3 set avail1="y" where db3.Code=tempupdate.Code="+(i+1)+"");
    Changed it to PreparedStatement, and use ? for y. It should be
    stmt.execute("update db3 set avail1=? where Code="+(i+1)+"");
    If you're going to use PreparedStatement, it ought to be:
    PreparedStatement ps = connection.prepareStatement("update db3 set avail1=? where Code=?");
    ps.setInt(1, y);
    ps.setInt(2, i+1);
    ps.executeUpdate();

  • Java.sql.SQLException:[Microsoft][ODBC Driver]Too few parameters Expected 1

    Hi friends,
    Greetings.
    i am trying to work with my inventory management system. My code is as follows and i getan error as follows:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few
    parameters. Expected 1.
    CODING:
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class iteminsert extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    Connection con;
    Statement r,s;
    ResultSet rs;
    int flag1=0;//flag1 is for seeing if itemcode already exists
    String str1,str2;
    String s0=req.getParameter("itemcode");
    String s1=req.getParameter("itemname");
    int s2=Integer.parseInt(req.getParameter("unit"));
    int s3=Integer.parseInt(req.getParameter("minlevel"));
    int s4=Integer.parseInt(req.getParameter("rate"));
    int a=1;
    int b=0;
    res.setContentType("text/HTML");
    PrintWriter out=res.getWriter();
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:stocks");
    r=con.createStatement();
    s=con.createStatement();
    rs=r.executeQuery("select * from stock where itemcode='"+s0+"'");
    while(rs.next())
    flag1++;
    if(flag1!=0)
    out.println("<body><h1 align=\"center\"><font color=\"green\">INVENTORY MANAGEMENT SYSTEM</font></h1><p>ITEM CODE ALREADY EXISTS!!!!</p><p>To insert an item with a different code, <a href=\"http://localhost:8000/stock/insert.html\">Click here</a> .</p><p>To go back to the main menu <a href=\"http://localhost:8000/stock/index.html\">click here</a></p></body>");
    else
    str1="insert into stock values('"+s0+"','"+s1+"',"+s2+","+s3+","+s4+","+a+")";
    str2="insert into stock values('"+s0+"','"+s1+"',"+s2+","+s3+","+s4+","+b+")";
    if(s3<=s4)
    s.executeUpdate(str2);
    out.println("<body><h1 align=\"center\"><font color=\"green\">INVENTORY MANAGEMENT SYSTEM</font></h1><p>ITEM HAS BEEN INSERTED. HOWEVER REORDER LEVEL IS <b><u>MORE THAN</u></b> QUANTITY AT HAND</p><p>To buy more <a href=\"http://localhost:8000/stock/purchase.html\">Click here</a></p><p>To go back to the main menu <a href=\"http://localhost:8000/stock/index.html\">click here</a></p>");
    else
    s.executeUpdate(str1);
    out.println("<body><h1 align=\"center\"><font color=\"green\">INVENTORY MANAGEMENT SYSTEM</font></h1><p>ITEM HAS BEEN INSERTED.</p><p>To buy more <a href=\"http://localhost:8000/stock/purchase.html\">Click here</a></p><p>To go back to the main menu <a href=\"http://localhost:8000/stock/index.html\">click here</a></p></body>");
    con.close();
    catch(Exception e)
    out.println("error"+ e);
    Please help. I have to use only Create statement and not PreparedStatement :(
    Thank You.
    Regards.
    Aravind

    your code is wrong on so many levels.
    you should not be embedding HTML in Java objects this way. wrong, wrong, wrong.
    JSPs are what you should be using.
    look at this line:
    rs=r.executeQuery("select * from stock where itemcode='"s0"'");the SQL query is supposed to be a bloody string. yours won't even compile.
    do it this way:
    PreparedStatement ps = connection.prepareStatement("select * from stock where itemcode = ?");
    ps.setString(1, itemCode);
    rs = ps.executeQuery();you don't close resources. you don't use code tags.
    too much wrong to fix here.
    %

  • Java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few...

    Can someone please help me? I get the error java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    The offending section of code is:
    int resultsTableID = 0;
    query = "SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = '" + file1ID + "' AND image_2_id = '" + file2ID + "'";
    System.out.println(query);
    rs = s.executeQuery(query);
    The select statement comes out:
    SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = '115' AND image_2_id = '116'
    There does not seem to be a problem with the parameter separations, so if anyone can spot what I have done wrong I would appreciate it.
    Thanks

    I have just tried what you advised: Not using single quotes, and I got the same error.
    The query now looks like:
    query = "SELECT results_table_01 FROM dbo_results_table_01 WHERE image_1_id = " + file1ID + " AND image_2_id = " + file2ID;
    Thanks for your help, but it did not work.

  • JDBC SQL Exception while updating an SQL database

    Hi Experts,
    Recently i have encountered a JDBC SQL exception while updating aSQL database as below,
    com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SAP_UPLOAD' (structure 'Statement'): java.sql.SQLException: No more data to read from socket
    the above system error didn't occur for all messages (so far happened twice), but i need to find an fix to overcome this system error.
    did anybody came across the above system error, please help me to resolve.
    Thanks

    Hi bandana,
    From SAP Note --> 831162
    17. Receiver: java.sql.SQLException During First Message Processing
    Q: When sending a message to a JDBC receiver channel for the first time after an extended inactivity period, I am observing a java.sql.SQLException in the adapter's processing, which refers to a closed connection or a timeout? What is causing this and how do I work around this problem?
    A: The database server has apparently closed the adapter's JDBC connection from the server side. Nevertheless, the message should be processed successfully during the next retry. If you want to completely eliminate the symptoms, enable the setting "Advanced Mode" -> "Disconnect from database after each message processing". Note that this might have a negative performance impact for high-volume processing.
    I would recommend you to go through the complete note !!! Very Informative .
    Regards,

  • Too few arguments MS Access exception

    Hello together!
    I am getting frustrated with that problem.
    I have a MS Access database and try to execute the following statement:
    SELECT * FROM RegisteredUser WHERE UName = "+userName+ " AND UPassword = "+password
    userName and password are Strings.
    The table and the columns are spelled exactly the same, i already checked this, but I gut the error: Too few arguments.
    Are there any other possible error reasons?
    When I copy my statement and execute it in MS Access then it works.
    Thanks a lot.

    Thanks for your help.
    Of course I will only store a hash value in the end version.
    I just need it for test reason now without a hash.
    Here is my code:
    public static boolean isUser(String userName, String password) throws SQLException
              Statement statement = DataBase.getConnection().createStatement();
         ResultSet resultSet = statement.executeQuery(
              "SELECT * FROM RegisteredUser WHERE UName = "+userName+ " AND UPassword = "+password+"");
         if (resultSet.next()) {
              resultSet.close();
                   statement.close();
              return true;
              } // if
         resultSet.close();
              statement.close();
              return false;
         }

  • SQL Exception in Access

    Hi,
    Getting a run-time error from a simple application:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    The offending statement is:
    rs = stmt.executeQuery("SELECT usr,pwd,type FROM user_login WHERE usr=\"guest\"");
    Using MS-Access. This SQL runs fine from the sql interface in Access.
    Any help or pointer will be appreciated. Please let me know if you need any more info.
    Thanks,
    Arun

    Thanks Paul.
    I did try your suggestion, though the exception does not occur any more there are no results for the valid query (which works fine in the sql interface of access as well).
    Any thoughts why such a behavior migt be happening?
    The string that I pass now is:
    SELECT usr,pwd,type FROM user_login WHERE usr='guest'
    The same statement fetches results from the sql interface while through the JDBC/ODBC interaction no results are produced.
    Thanks for your time and replies.
    -- Arun

  • SQL Exception from simple query

    java.sql.sqlexception: [microsoft][odbc microsoft access driver] Too few parameters. Expected 1.
    I dont understand why im getting this because i think my sql statement is correct but here it is
    String query = "SELECT User FROM Users WHERE Password = pass";
    and the exception also points out this line
    ResultSet result = stat.executeQuery(query);

    I see no parameters, and in the abstract that SQL ought to work.
    However, I halfway suspect that either User, Users, Password, or pass is a reserved word and somebody is getting confused. Try renaming your columns and table...

  • Too few parameters

    Hi friends,
    please solve this below problem. Exception is "-------Too few parameters"..
    import java.io.*;
    import Java.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.sql.*;
    public class EmpData extends HttpServlet {
    public void service (HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
    try {
    PrintWriter out;
    out=response.getWriter();
    response.setContentType("text/plain");
    String a =request.getParameter("id");
    String b =request.getParameter("ename");
    String c =request.getParameter("esal");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:malloc");
    Statement stmt = con.createStatement();
    out.println(a);
    out.println(b);
    out.println(c);
    stmt.executeUpdate("insert into emp values (" + " ' " + a + " ' " + " , " + " ' " + b + " ' " + ", " + " ' " + c +" ' "+ ")" );
    }catch(Exception e) {
    System.out.println(e);
    }

    What's the actual value of that string? Don't just post a dog's breakfast of quotes that you put in your code to compute the string, post the string.
    And if you had posted this in the JDBC forum (being the question about your database queries that it is) you would have been told to use a PreparedStatement to avoid that awful mess of quotes. That would be a good idea in any case.
    When you look at the string you're probably going to find you are missing quotes around something that is supposed to be a string constant, and Access would try to interpret that as a table name or a column name. If there is no such table or column you get this sort of message.

  • SQL Exception: A lock could not be obtained within the time requested

    Hi Friends,
    In one of my processes there is an automatic activity which reads some records from an excel sheet and loads them in a separated array of objects and then for each object in the array it creates a copy using Split-N. There are about 2000 records read which takes about 3 minutes to process in Fuego Studio. But, when it comes to process Split-N activity, it takes pretty long time... keeps processing the for loop for about 15 mins and then I get SQL Exception: SQL Exception: A lock could not be obtained within the time requested (Details below). In the meantime it processes close to 950 records.
    In order to resolve it I tried increasing timeout interval in Server Preferences to 2400 secs changig default 1200 secs but no results.
    To my utter surprise none of the logMessages get logged until Split-N activity completes.
    Can somebody please put more light on this and suggest if I'm doing something wrong?
    FYI, I'm posting my Split-N code and the SQL exception details.
    EXCEPTION
    =========
    Problems updating the BAM database. Reason:Unable to connect to the database.
    Caused by: A lock could not be obtained within the time requested
    fuego.analyzer.UpdaterRuntimeException: Unable to connect to the database.
         at fuego.analyzer.UpdaterRuntimeException.cannotConnecToDatabase(UpdaterRuntimeException.java:80)
         at fuego.analyzer.UpdaterRunner.synchronizeMetadata(UpdaterRunner.java:494)
         at fuego.analyzer.UpdaterRunner.run(UpdaterRunner.java:273)
         at fuego.analyzer.UpdaterRunner.runUpdater(UpdaterRunner.java:176)
         at fuego.server.service.BAMRunnerService.runUpdater(BAMRunnerService.java:62)
         at fuego.server.execution.BAMUpdater.execute(BAMUpdater.java:33)
         at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:290)
         at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:465)
         at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:543)
         at fuego.transaction.TransactionAction.start(TransactionAction.java:216)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:116)
         at fuego.server.execution.DefaultEngineExecution.executeAutomaticWork(DefaultEngineExecution.java:56)
         at fuego.server.execution.EngineExecution.executeAutomaticWork(EngineExecution.java:42)
         at fuego.server.execution.ToDoItem.executeAutomaticWork(ToDoItem.java:265)
         at fuego.server.execution.ToDoItem.run(ToDoItem.java:536)
         at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:752)
         at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:732)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:138)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:130)
         at fuego.fengine.ToDoQueueThread$PrincipalWrapper.processBatch(ToDoQueueThread.java:429)
         at fuego.component.ExecutionThread.work(ExecutionThread.java:816)
         at fuego.component.ExecutionThread.run(ExecutionThread.java:395)
    Caused by: SQL Exception: A lock could not be obtained within the time requested
         at com.ibm.db2cs.m.j.generateCsSQLException(Unknown Source)
         at com.ibm.db2cs.m.b.wrapInSQLException(Unknown Source)
         at com.ibm.db2cs.m.b.handleException(Unknown Source)
         at com.ibm.db2cs.m.d.handleException(Unknown Source)
         at com.ibm.db2cs.m.t.handleException(Unknown Source)
         at com.ibm.db2cs.m.s.closeOnTransactionError(Unknown Source)
         at com.ibm.db2cs.m.s.movePosition(Unknown Source)
         at com.ibm.db2cs.m.s.next(Unknown Source)
         at fuego.jdbc.FaultTolerantResultSet.next(FaultTolerantResultSet.java:553)
         at fuego.analyzer.Updater.loadInstanceInfoValues(Updater.java:1039)
         at fuego.analyzer.Updater.loadInstanceInfoValues(Updater.java:988)
         at fuego.analyzer.Updater.loadInstanceInfo(Updater.java:982)
         at fuego.analyzer.Updater.synchronize(Updater.java:252)
         at fuego.analyzer.UpdaterRunner.synchronizeMetadata(UpdaterRunner.java:480)
         ... 20 moreSplit-N Code
    ==========
    for (int i = 0; i <= (eventList.events.count() - 1); i++) {
        copy = clone(this);
        logMessage("INSTANCE(" + (i + 1) + ") CLONED: " + copy.currEvent.text_data, severity : DEBUG);
        copy.currEvent = eventList.events.event;
    logMessage("Event(" + (i + 1) + ") Assigned.", severity : DEBUG);
    copy.eventList = null;
    logMessage("EventList(" + (i + 1) + ") set to null.", severity : DEBUG);
    copy.description = (copy.currEvent.text_data + "(" + copy.currEvent.login_name + ")").strip(len : 200);
    logMessage("EVENT(" + (i + 1) + ") COPIED: " + copy.currEvent.text_data, severity : DEBUG);
    Any help in this regard would be highly appreciated.
    Regards,
    Manoj
    =============================================
    [url http://www.economicalwebsites.com]Cheap Web Hosting by EconomicalWebsites.com
    =============================================
    Edited by goelmk at 12/05/2007 8:14 AM

    Hi Friends,
    In one of my processes there is an automatic activity which reads some records from an excel sheet and loads them in a separated array of objects and then for each object in the array it creates a copy using Split-N. There are about 2000 records read which takes about 3 minutes to process in Fuego Studio. But, when it comes to process Split-N activity, it takes pretty long time... keeps processing the for loop for about 15 mins and then I get SQL Exception: SQL Exception: A lock could not be obtained within the time requested (Details below). In the meantime it processes close to 950 records.
    In order to resolve it I tried increasing timeout interval in Server Preferences to 2400 secs changig default 1200 secs but no results.
    To my utter surprise none of the logMessages get logged until Split-N activity completes.
    Can somebody please put more light on this and suggest if I'm doing something wrong?
    FYI, I'm posting my Split-N code and the SQL exception details.
    EXCEPTION
    =========
    Problems updating the BAM database. Reason:Unable to connect to the database.
    Caused by: A lock could not be obtained within the time requested
    fuego.analyzer.UpdaterRuntimeException: Unable to connect to the database.
         at fuego.analyzer.UpdaterRuntimeException.cannotConnecToDatabase(UpdaterRuntimeException.java:80)
         at fuego.analyzer.UpdaterRunner.synchronizeMetadata(UpdaterRunner.java:494)
         at fuego.analyzer.UpdaterRunner.run(UpdaterRunner.java:273)
         at fuego.analyzer.UpdaterRunner.runUpdater(UpdaterRunner.java:176)
         at fuego.server.service.BAMRunnerService.runUpdater(BAMRunnerService.java:62)
         at fuego.server.execution.BAMUpdater.execute(BAMUpdater.java:33)
         at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:290)
         at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:465)
         at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:543)
         at fuego.transaction.TransactionAction.start(TransactionAction.java:216)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:116)
         at fuego.server.execution.DefaultEngineExecution.executeAutomaticWork(DefaultEngineExecution.java:56)
         at fuego.server.execution.EngineExecution.executeAutomaticWork(EngineExecution.java:42)
         at fuego.server.execution.ToDoItem.executeAutomaticWork(ToDoItem.java:265)
         at fuego.server.execution.ToDoItem.run(ToDoItem.java:536)
         at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:752)
         at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:732)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:138)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:130)
         at fuego.fengine.ToDoQueueThread$PrincipalWrapper.processBatch(ToDoQueueThread.java:429)
         at fuego.component.ExecutionThread.work(ExecutionThread.java:816)
         at fuego.component.ExecutionThread.run(ExecutionThread.java:395)
    Caused by: SQL Exception: A lock could not be obtained within the time requested
         at com.ibm.db2cs.m.j.generateCsSQLException(Unknown Source)
         at com.ibm.db2cs.m.b.wrapInSQLException(Unknown Source)
         at com.ibm.db2cs.m.b.handleException(Unknown Source)
         at com.ibm.db2cs.m.d.handleException(Unknown Source)
         at com.ibm.db2cs.m.t.handleException(Unknown Source)
         at com.ibm.db2cs.m.s.closeOnTransactionError(Unknown Source)
         at com.ibm.db2cs.m.s.movePosition(Unknown Source)
         at com.ibm.db2cs.m.s.next(Unknown Source)
         at fuego.jdbc.FaultTolerantResultSet.next(FaultTolerantResultSet.java:553)
         at fuego.analyzer.Updater.loadInstanceInfoValues(Updater.java:1039)
         at fuego.analyzer.Updater.loadInstanceInfoValues(Updater.java:988)
         at fuego.analyzer.Updater.loadInstanceInfo(Updater.java:982)
         at fuego.analyzer.Updater.synchronize(Updater.java:252)
         at fuego.analyzer.UpdaterRunner.synchronizeMetadata(UpdaterRunner.java:480)
         ... 20 moreSplit-N Code
    ==========
    for (int i = 0; i <= (eventList.events.count() - 1); i++) {
        copy = clone(this);
        logMessage("INSTANCE(" + (i + 1) + ") CLONED: " + copy.currEvent.text_data, severity : DEBUG);
        copy.currEvent = eventList.events.event;
    logMessage("Event(" + (i + 1) + ") Assigned.", severity : DEBUG);
    copy.eventList = null;
    logMessage("EventList(" + (i + 1) + ") set to null.", severity : DEBUG);
    copy.description = (copy.currEvent.text_data + "(" + copy.currEvent.login_name + ")").strip(len : 200);
    logMessage("EVENT(" + (i + 1) + ") COPIED: " + copy.currEvent.text_data, severity : DEBUG);
    Any help in this regard would be highly appreciated.
    Regards,
    Manoj
    =============================================
    [url http://www.economicalwebsites.com]Cheap Web Hosting by EconomicalWebsites.com
    =============================================
    Edited by goelmk at 12/05/2007 8:14 AM

  • Too few values in the second queue in function useOneAsMany

    Hi - I am having problems with useOneAsMany while doing sales transactions.
    The simplified Source Mapping is
    POSLog   0..1
    ......Transaction unbounded
    ...........SequenceNumber  1..1
    ...........RetailTransaction   unbounded
    ................LineItem               unbounded
    .....................Sale                       0..1
    ........................Field                         1
    The Target Mapping is...
    SalesOrderLine_JDBC     unbounded         Sale(Context:POSLog)
    ........Insert                        1
    ...........access                  1
    ...............OLGUI                0..1    (SequenceNumber goes here)
    ...............OLOVP              0..1     (sale specific price goes here)
    Only Sales are written to the Line file and the POSLogs that are being sent are often multi-transactional.
    I have tried to resolve this problem using graphical variables (SAP PI 7.1 Mapping Enhancements Series: Using Graphical Variable) that helped save the ItemID but incorrectly in the case of multi-transactional POSLogs.
    The UseOneAsMany function seemed to be the answer (http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm) but when I try and use it I get an exception - I get this exception no matter how I set the context for the Sale node for the 2nd parameter...
    + Exception:com.sap.aii.mappingtool.tf7.FunctionException: Too few values in the second queue in function useOneAsMany. The number of values for all contexts must be the same as the number of values for the third queue in class com.sap.aii.mappingtool.flib7 +.
    Is it possible to do this in Graphical mapping or will I have to fall back on XSLT???

    Hi...
      Please find the below link,about how to configure IDOC adapters .
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d19fe210-0d01-0010-4094-a6fba344e098
    Regards,
    Leela

  • SQL exception occurred during PL/SQL upload in WEB ADI Upload

    Hi All,
    I created Custom Integrator with META DATA as Update. This Integrator Downloads the data and will update the date. Once it is updated, I am uploading the same. For Quite Some Time, Everything is working fine and no issue.
    All of Suddenly , I am getting the error message 'SQL exception occurred during PL/SQL upload.' When I am trying to update and upload the values in the same custom integrator.
    My Oracle Apps and DB Version are
    RDBMS : 11.1.0.7.0
    Oracle Applications : 12.1.3
    Any Help is appreciated.

    I found the issue. If you check read only check box for the mandataory parameters that Package is using, then we get this issue. Try to avoid read only check box for mandatory parameters in th epackage.
    For Example.
    I am using hr_person_extra_info_api.update_person_extra_info API in my custom package, In this API, p_person_extra_info_id is the mandaory parameter.
    I am trying to download the data and updating the data and uploading the values with the custom WEB ADI. In the custom layout, I checked ready only box to parameter 'p_person_extra_info_id '. With this I am getting issue 'SQL exception occurred during PL/SQL upload in WEB ADI Upload'.
    again I unchecked the read only button to this 'p_person_extra_info_id ' Parameter. It is uplaoding and working with no issues.
    Thanks Guys for all your help.

  • Too few parameters error

    hi,
    i keep getting the following error:
    SQLException in PAUserBean - getWorkNumber java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.here is code:
    public String getWorkNumber(String Id) {
         String workNumber = "";
         try {
              Connection conn = DriverManager.getConnection("jdbc:odbc:PA");
              Statement s = conn.createStatement();
              String sql = "SELECT WORKER.WORK_PHONE_NBR FROM WORKER WHERE WORKER.USER_ID=" + Id + ";";
              ResultSet rs = s.executeQuery(sql);
              if(rs.next()) {
                   workNumber = formatPhoneNumber(rs.getString("WORK_PHONE_NBR"));     
         }catch(SQLException e) {
              System.out.println("SQLException in PAUserBean - getWorkNumber " + e.toString());
         return workNumber;
    }here is the database map:
    WORKER TABLE:
    USER_ID - Number (primary key)
    WORK_PHONE_NMR - Text
    I'm using an MS Access database, when i run the following query in MS Access it returns the number:
    SELECT work_phone_nbr
    FROM Worker
    where id=102;
    odd thing is the jsp page does display the number, meaning the query is ok, but i see tomcat's log with that error, any ideas what it means? what parameter am i missing?
    Thank you.

    Enclose the parameter with single quotes. Also, you don't need the semi-colon.
    String sql = "SELECT WORKER.WORK_PHONE_NBR FROM WORKER WHERE WORKER.USER_ID='" + Id + "'";

Maybe you are looking for