Updating and reading same column with PreparedStatement

sqlStr = "UPDATE user_mstr SET userid=?, username=?, duration=?, location=?, expiry_date=?, remainder_days=? WHERE userid=?";
stmt = DBConnection.getPreparedStatement(conn,sqlStr);
stmt.setString(1,strUserid);
stmt.setString(2,strUsername);
stmt.setString(3,strDuration);
stmt.setString(4,strLocation);
stmt.setDate(5,sqlDate);
stmt.setString(6,strRemainderDays);
stmt.setString(7,strUserid);
int rowcount = stmt.executeUpdate();This is the problem i'm facing right now: A numberformatexception is always thrown, meaning that the statement did not execute properly.
There is nothing wrong with the SQL, because i've used the query analyzer, and the record was updated fine.
There is also nothing wrong with the date field because when i took the code for updating the date column out, the update was fine too.
So what could be wrong here? Is it because double usage of userid in the preparedstatement? I think that is the problem, because when i did not update the userid, the update is fine. Is it that, i cannot update a field that is currently being used when using a prepared statement?
Is there a way to go around this besides adding another recordid column?
Thanks all.
Edited by: tsek1125 on Nov 13, 2007 8:58 PM

if(rowcount > 0){
                        response.sendRedirect("updated.jsp");
}else {
                        throw new NumberFormatException("");
}Sorry BalusC, I forgot to post this portion: the NFE occurs only because the statement did not execute properly.. This portion is right after the first code chunk that i've posted.
Using the Netbeans debugger, i found out that all the fields are 'correct'. And that the NFE is thrown by: int rowcount = stmt.executeUpdate() Which leaves me to wonder what the problem is.
The userid is actually a string and not a real 'id', duration and remainder days are integers.
To clarify, now i've narrow the problem to: when i choose to update the userid column, it does not work. (and i think this is due to the part of the sql statement "WHERE userid = ?")
Why is a possible reason and solution? Thanks for your help :)
*/

Similar Messages

  • HT1349 I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???

    I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???

    Welcome to the Apple Community.
    Enter the details of her second account at system preferences> mail, contacts & calendars.

  • SUN TEAM: Bugs in update and delete a record with long query

    Creator Team,
    In my opinio there is a bug issue with update and delete a record with a complex sql query. I�m using oracleXE and ojdbc14.ar with tomcat
    In just two page I�m receving the following msg (I have 12 pages doing the same thing with less complex queries)
    * Number of conflicts while synchronizing: 1 SyncResolver.DELETE_ROW_CONFLICT row 2 won't delete as values in database have changed: 2006-11-29
    * Cannot commit changes: Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 0 values changed in database
    when i tried to delete or commit the updated changes in the register...
    The interesting is that this code function with jdbc of jsc...
    My query is bellow:
    SELECT ALL PATRIMONIO.TB_BEM.INCODIGOBEM,
    PATRIMONIO.TB_BEM.VATOMBAMENTO,
    PATRIMONIO.TB_BEM.VAMATERIAL,
    PATRIMONIO.TB_BEM.INCODIGOSETOR,
    PATRIMONIO.TB_SETOR.VANOME AS NOMESETOR,
    PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR,
    PATRIMONIO.TB_FORNECEDOR.VANOME AS NOMEFORNECEDOR,
    PATRIMONIO.TB_BEM.DACHEGADA ,
    PATRIMONIO.TB_BEM.DASAIDAPREVISTA,
    PATRIMONIO.TB_BEM.DASAIDAEFETIVA,
    PATRIMONIO.TB_BEM.VAMARCA,
    PATRIMONIO.TB_BEM.VAMODELO,
    PATRIMONIO.TB_BEM.VADESBAIXABEM,
    PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO,
    PATRIMONIO.TB_TIPOAQUISICAO.VANOME AS NOMETIPOAQUISICAO
    FROM PATRIMONIO.TB_BEM , PATRIMONIO.TB_TIPOAQUISICAO, PATRIMONIO.TB_SETOR, PATRIMONIO.TB_FORNECEDOR
    WHERE PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO = PATRIMONIO.TB_TIPOAQUISICAO.INCODIGOTIPOAQUISICAO
    AND PATRIMONIO.TB_BEM.INCODIGOSETOR = PATRIMONIO.TB_SETOR.INCODIGOSETOR
    AND PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR = PATRIMONIO.TB_FORNECEDOR.INCODIGOFORNECEDOR
    AND PATRIMONIO.TB_BEM.INCODIGOBEM LIKE ?
    AND PATRIMONIO.TB_BEM.VATOMBAMENTO LIKE ?
    AND PATRIMONIO.TB_BEM.VAMATERIAL LIKE ?
    AND PATRIMONIO.TB_SETOR.VANOME LIKE ?
    AND PATRIMONIO.TB_FORNECEDOR.VANOME LIKE ?
    ORDER BY PATRIMONIO.TB_BEM.VATOMBAMENTO ASC
    Why this problem is happing? Did you had some solution for that? Is the problem because the query is too long?!
    please help me!
    Gustavo Callou

    Hello people,
    I�m doing this to try to solution that bug:
    This code is working fine... but I do not understand why I�m receiving the nullpointer exception!??!!?
    // create a new rowset
    CachedRowSetXImpl pkRowSet = new CachedRowSetXImpl();
    try {
    RowKey rk = tableRowGroup1.getRowKey();
    if (rk != null) {
    // set the rowset to use the Patrimonio database
    pkRowSet.setDataSourceName("java:comp/env/jdbc/Patrimonio");
    String query = "DELETE FROM TB_BEM WHERE INCODIGOBEM = "+tb_bemDataProvider.getValue("INCODIGOBEM", rk).toString();
    pkRowSet.setCommand(query);
    pkRowSet.setTableName("TB_BEM");
    // execute the rowset -- which will contain a single row and single column
    pkRowSet.execute();
    pkRowSet.next();
    info("Apagado");
    } catch (Exception ex) {
    log("ErrorDescription", ex);
    error(getApplicationBean1().trateException(ex.getMessage()));
    } finally {
    pkRowSet.close();
    Please someone help me!!!
    Gustavo Callou

  • How to update person or group column with peopleeditor control values

    Hi,
    I have created custom aspx page and added "PeopleEditor" control(can select multiple users)  in that page. Now I am trying to update person or group column with peopleeditor control values.I am not getting any error if I select single user
    in PeopleEditor control but getting error if I select more than one user.
    UpdateItem(listItem, "ListColumnName",
    listItem.ParentList.ParentWeb.EnsureUser(peopleeditorId.CommaSeparatedAccounts));
    Can anybody help me out to resolve the issue?
    Thank you in advance!!!
    AA.

    First get all the users/groups from the PeapleEditor by using PeapleEditor.ResolvedEntities
    foreach (PickerEntity pickerEntity in peopleEditor.ResolvedEntities)
    SPPrincipalType principalType = (SPPrincipalType)Enum.Parse(typeof(SPPrincipalType), pickerEntity.EntityData["PrincipalType"].ToString());
    if (principalType == SPPrincipalType.User || principalType == SPPrincipalType.SecurityGroup)
    string loginName = pickerEntity.Key;
    //your code here
    else if (principalType == SPPrincipalType.SharePointGroup)
    string groupName = pickerEntity.Key;
    //your code here
    Add all the users/groups in an instance of SPFieldUserValueCollection
    and then update your list item.
    SPFieldUserValueCollection users = new SPFieldUserValueCollection();
    users.Add(new SPFieldUserValue(web,user.ID,user.Name));
    item["YourUserColumn"] = users;
    item.Update();

  • Hey. I have recently made an update on my daughters iMac, particularly update OS X 10.9.4, when finished, its still asking for update and the same update stills remarked in the apple update menu and at the App store app. Why doesn't stop asking f.ud?

    Hey. I have recently made an update on my daughters iMac, particularly the update OS X 10.9.4, when finished, its still asking for update and the same update stills remarked as ready in the apple update menu and remarked as 1 to go at the App store app. Why doesn't stop asking for update when its done like 5 times or more? Thanks for taking your time!

    If you don't already have a current backup, back up all data, then reinstall the OS.* You don't need to erase the startup volume, and you won't need the backup unless something goes wrong. If the system was upgraded from an older version of OS X, you may need the Apple ID and password you used.
    If you use FileVault 2, then before running the Installer you must launch Disk Utility and select the icon of the FileVault startup volume ("Macintosh HD," unless you gave it a different name.) It will be nested below another icon with the same name. Click the Unlock button in the toolbar and enter your login password when prompted. Then quit Disk Utility to be returned to the main Recovery screen.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it. The same goes for Xcode. All other data will be preserved.
    *The linked support article refers to OS X 10.9 ("Mavericks"), but the procedure is the same for OS X 10.7 ("Lion") and later.

  • HT4528 I installed the new update and it is frozen with a picture of the charger head, an arrow pointing to a iTunes image. How do I get my phone to work properly?

    I installed the new update and it is frozen with a picture of the charger head, and an arrow pointing to a iTunes icon. How do I get my phone to work properly?

    What happened when you tried to restore and update the iPod?

  • When i do update to my iphone my pc shut down and dont finish update and now not connect with my pc

    when i do update to my iphone my pc shut down and dont finish update and now not connect with my pcm just show (my iphone ) connect with itunes

    Try this:
    http://support.apple.com/kb/HT1808
    Regards.

  • How to load and unload same SWF with different xmlFilePath?

    I have a slideshow on my homepage and try to load and unload same instance with different xmlFilePath based on language on the same page.
    var flashvars = {
            xmlFilePath: escape("http://www.bodto.com.tr/kik.aspx"),
            xmlFileType: "OPML",
            lang: swfobject.getQueryParamValue("lang")    
            //initialURL: escape(document.location)   
          var params = {
            bgcolor: "#000000",  
            allowfullscreen: "true",
            wmode:"transparent",
            allowScriptAccess: "always"
          var attributes = {}
              swfobject.embedSWF("/swf/slideshowpro.swf", "flashcontent", "550", "400", "10.0.0", false, flashvars, params, attributes);
    Actionscript3
    var langPath = root.LoaderInfo.parameters["xmlFilePath"]+root.LoaderInfo.parameters["lang"];
    my_ssp.xmlFilePath = langPath;
    var fileType = root.LoaderInfo.parameters["xmlFileType"];
    my_ssp.xmlFileType = fileType;
    Based on above informations, how could I achieve it?

    Suddenly that code in the following gives me some error
    var langPath = root.LoaderInfo.parameters["xmlFilePath"]+root.LoaderInfo.parameters["lang"];
    my_ssp.xmlFilePath = langPath;
    var fileType = root.LoaderInfo.parameters["xmlFileType"];
    my_ssp.xmlFileType = fileType;
    Access of possibly undefined property LoaderInfo through a reference with static type flash.display:DisplayObject.
    The only code snippet works is
    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
    for (var param in paramObj) {
       if (param == "xmlFilePath") {
          my_ssp.xmlFilePath = paramObj[param];
       if (param == "xmlFileType") {
          my_ssp.xmlFileType = paramObj[param];

  • What mechanism Oracle 10g use for write (Insert/ Update) and Read (Select)?

    Hi
    What mechanism Oracle 10g use for write (Insert/ Update) and Read (Select)?
    Thank you

    Aren't the answers given in PL/SQL forum sufficient enough?Well, as the first answer in that forum directed the OP to this forum you can hardly blame them for the repost.
    There is some high-level stuff in the Concepts Guide. If that is insufficient the OP will need to tell us what more details they need to know (and perhaps why).
    Cheers, APC

  • Error updating Process Form: Same Column exist with a different variant

    Hi All,
    I have a process form of a resource with following fields :
    Name VariantType Length FieldLabel FieldType Order
    UD_EDIR_BWUSER   boolean       1          BWUser    Checkbox      25
    UD_EDIR_ISUUser    boolean       1          ISUUser    Checkbox      26
    Now, I have to changes these field from boolean to string. For that, I created a new process form version and update like this:
    1. Delete these fields first.
    2. Add two new fields:
    UD_EDIR_BWUSER String 4 BWUser Textfield 25
    UD_EDIR_ISUUser String 4 ISUUser Textfield 26
    Now, when I tried saving the form, I got following error
    Same Column exist with a different variant in current or previous form.
    I also tried creating again a new version of process form and tried updating these field instead of re-creating them but I was able to update the FieldType only ( not able to update the Variant type and length).
    If anyone know how to resolve this issue, please reply.
    Cheers,
    Sunny

    Hi Rajiv,
    Thanks for the reply. I re-created these field in a new version but gave a different name this time like this:
    UD_EDIR_SAP_BW_USER String 4 SAPBWUser TextField 25
    UD_EDIR_SAP_ISU_USER String 4 SAPISUUser TextField 26
    and it worked for me.
    Cheers,
    Sunny

  • Acrobat 7 and Reader 8 stall with latest Windows Vista Update

    After downloading and installing the most recent Windows Vista 64 bit update, neither reader or acrobat will start when I attempt to open a .pdf document. I ran 'system restore' to undue the Windows Update and all is now fine, .pdf's will now open using acrobat or reader... I believe this update is the culprit to acrobat or reader being able to start once the updates been installed: Windows Live Essentials 2011 (KB2434419) Download size: 157.3 MB Update type: Recommended

    hmmm, my version (7.0.9) of AA7 pro runs just fine on my copy of Windows 64 bit (longhorn) using the AMD 64 bit processor... Unless I install the latest windows update... Then, as already stated, both AA7 and Reader fail to start when I attempt to open an existing .pdf... MS needs to better debug the current windows update file...

  • 10.4.7 update  and external firewire problems with HD corrupion

    Dear all,
    Advised by Jpfresno I started this new topic about Tiger 10.4.7 update.
    I will repeat my post and what was happening 2 weeks ago:
    “In 5 years 10.4.7 update was a tragedy for my Powerbook Ti 667. When I update from 10.4.6 to 10.4.7 my 300 GB firewire drive gets corrupted, after repairing it with DiskWarrior and after connecting it to my PowerBook my computer freezes and I must shut it down via powerbutton. Safari also crashes after the update.
    I just erase my Hard Drive and after that install 10.4 and update with combo to 10.4.7. But I had the same problems: finder freezes with connected firewire devices and also safari when browsing. I spend a week trying to solve the problem but no luck.
    Yesterday and with no firewire devices, 10.4.7 freeze and I have big trouble in order to started my powerbook!!! Even when i insert the 10.4 install DVD it did not detected my HD. Finally I get it to work and install 10.4 and combo update to 10.4.6 and everything works. My external firewire drive and safari. I already diagnose my HD with disk utility, TechTool and directories with Diskwarrior and everything is ok.
    I clone my 10.4.6 to firewire, boot from it and everything is working. I let my external drive connected and finder does not freeze.
    My conclusion is that the problem is 10.4.7 update. It only give me problems and I was getting crazy with it. 10.4.6 is working good and I do not advice anyone to update to 10.4.7.”
    Last week after reinstalling 10.4.6 I started to have HD problems with my Powerbook 667. I did a surface scan with TechTool I it reported bad sector. Then I done a zero disk format but after a second surface scan TechTool also reported bad sector. Then I take the decision to replace my internal HD. I bought a Samsung 40GB Hard Drive and installed it on my PowerBook. Then I have done a clean installation of 10.4.6 with all applications that I need and clone it to my hard drive with Intego Personal Backup software. Everything works on 10.4.6. and external firewire drive.
    After that everything is ok. But I decided to test if my problem derivates from 10.4.7 update or from previous HD corruption. Then I install 10.4.7 update on my Internal Hard Drive. Everything is working good but after connecting my external Hard Drive the finder started to freeze!!!!!!!!!. After that I tried cloning HD to external firewire with Intego personal Backup. Everything was working good but when it was finishing the backup process started to give errors!! I started panic. I interrupted the backup process but after and after restart I found something strange with 10.4.7. The system started up, I login but I could not started any application!!!??? All my application died!
    Then I have done one more clean installation of tiger and 10.4.6 update.
    My conclusions are that the 10.4.7 update causes all the problems that I have on my PowerBook, because I used the same methods and same software/hardware on 10.4.6 and did no have any problem.
    This last two weeks were very difficult to me. I tough that these problems do not happen with Apple computers but I was wrong!!! It is very hard to me to deal with it. I always said to my friends that I never had problems with Apple computers. I accept that a hard drive died because the use of it but I can not accept that a system update cause me 2 weeks of hard problems and make me loose precious work information! I always love apple computers and Apple OS but now I am disappointed
    If anyone can explain what happen or have a solution for those problems?
    Thanks for the comprehension and collaboration.
    Best Regards
      Mac OS X (10.4.6)  

    Hi, alsvieira.
    There are some things you did not check in all of your troubleshooting:
    1. Run the Apple Hardware Test (AHT) that came the affected computer. See my "Apple Hardware Test" FAQ for comprehensive advice on using the AHT in troubleshooting.
    2. re: FireWire troubleshooting: Here is some general troubleshooting advice that may help if problems return with your FireWire drive:1. Review the AppleCare Knowledge Base document "What to do if your computer won't recognize a FireWire device".
    2. If this problem occurred after installing a recent Mac OS X Update, and you are also unable to mount CDs, DVDs, or disk images perform the steps in this Mac OS X Hints article. This worked under Panther and may also work in certain situations under Tiger.
    3. Power-on the FireWire drive before starting up (booting) your Mac.
    4. Reset PRAM and NVRAM.
    5. Resett the power-management chip in your Mac.
    6. Try a different FireWire port. James Wiebe, CEO of WiebeTech, has published FireWire Port Failures in Host Computers and Peripheral Devices, a white paper providing backgroud information and technical analysis concerning the causes of failure for FireWire ports. This may provide additional diagnostic information.
    7. Micromat TechTool Pro version 4 can test the FireWire bus in your computer: this tests the bus — not the ports — but if the problem is on the FireWire bus on the logic board, it should reveal it.
    8. Check with the manufacturer of your FireWire drive or enclosure to see if any firware updates are available for such.
    9. Hopefully, the partition map on the FireWire drive is not damaged. This can happen if the FireWire drive was not Ejected before being disconnected or powered off. If it still refuses to mount, you may need to employ data recovery tools or services: see my "Data Recovery" FAQ.Note that some of the information above is from the "FireWire Problems" chapter of my book, Troubleshooting Mac® OS X.
    Dr. Smoke
    Author: Troubleshooting Mac® OS X
    Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • HT201210 I tried to update my iPod to the latest version and it didn't complete.  says it could not be updated and my iPod froze with the apple icon and the progression bar.  it won't go away. iTunes doesnt recognize the device.

    I tried to update the latest version for the iPod touch and it couldn't complete the install.  my iPod screen had the apple icon with the progression bar when it couldn't update and it stuck there.  iTunes doesn't recognize my device. 
    How do I restore, if iTunes doesn't see my iPod?

    Plug your device into iTunes. Hold the home & sleep buttons at the same time. After 10 secs release the 2 buttons. iTunes will tell you it's found a device in DFU mode. The iPod screen will stay black. At this point do a restore. If you see the Apple logo you have held them for too long.

  • When I plug in my iPod and it syncs it says that a bunch of my apps cannot be loaded because my iPod does not have the latest software to support them, but I have done all of the iPod software updates and the same apps were working fine just weeks ago...?

    I plug in my iPod to charge from my computer and it syncs with my iTunes, but I've been getting a message that a list of 13 of my apps cannot be loaded onto my iPod because it doesn't have the latest software to support them. I have done all the software updates for my iPod and iTunes says it is completed up-to-date. Do I need to delete the apps and redownload them or what?
    Any help is appreciated! Thanks.

    ok well like lllaass said, most apps require 4.3 or later iOS software. chances are since the apps worked before, the apps themselves got updated and will no longer work with your software version.

  • HT4623 I am trying to update my i-phone 4 with IOS 7.1.1 it has twice got 400mB in to the 1.3GB update and then dropped out with an "error has occured" message.....any ideas?

    I-phone 4........I am being auto-prompted to update my IOS from 7.1 to 7.1.1. Each time I try to do that on i-tunes it gets to about 400Mb of the 1.3Mb file and then drops out with an "error has occured" message. I have 5Gb free space on the phone. I have tried to do that wirelessly also and it says "an error has occured while checking for a software update"........does anyone have any ideas?....thanx

    Dear Jody..jone5
    Good for you that can't update your iphone because I did it and my iphone dosen't work for example I can't download any app like Wecaht or Twitter..
    Goodluck
    Atousa

Maybe you are looking for

  • Iphoto & Preview will not open after software update

    I did a software update on my macbook pro yesterday, and cannot open iPhoto or review. I am running on OSX 10.7.2 and the iPhoto is '11 9.2.1 Preview is 5.5.1 When i open either app nothing comes up, only the bar at the top of the screen changes to w

  • Adding BC e-commerce pages to Muse menu.

    Hi there I want to use the menu I created in muse to link to the catalog and products I've created in Business Catalyst. Muse page - http://infinityshop01.businesscatalyst.com/fittings.html Business Catalyst page - http://infinityshop01.businesscatal

  • How do i find a newer version of itunes for my system?

    i have Mac OS X version 10.2.8. and I tunes 4 i'd like to upgrade so i can have podcast etc but haven't a clue how to do it!

  • Attempting to use java api to publish .bqy jobs fails

    Attempting to execute the AddBQYJob sample java program from the Hyperion SDK ...samples/java directory using a .bqy file, which published correctly using the Web browser interface, fails on the repository.loadBQYJob() method with the following messa

  • Which version do I need to upgrade to Elements 10.

    If I want to upgrade from Elements 7 to Elements 10, can I buy the full version or do I need the Upgrade version to be able to read all my information (tags, catagories, edits)?  I can find the full version for less $ than the Upgrade version. Thanks