More than 1 row is added but not!!!!

The basic problem is that I execute the class that contains the code below multiple times, therefore, I assume that the contents of the prepared statement should be added to the database multiple times. 
This is not happening as when I open the Access database, the contents of the prepared statement appear only once ie; there is only 1 row in the database. 
What is even more confusing is that when the code is executed, if you look at the while loop in the code fragment, the print statements in this while loop are actually printing 9 print statments, this means that the while loop must be "looping" through the result set 9 times (the amount of times the code has been executed so far), which means that there must be 9 rows in the database for this to happen!!!!  So where is this data going?? Any ideas? It must be going to the database.
try {
                    theConnection = DriverManager.getConnection(url,"foy","foy");
                    theConnection.setAutoCommit(false);
                    //idea is that the Result Set is scrollable (more than once and so if it scrolled for information and
                    //nothing is found, then it can be scrolled again and find other matching images that are less accurate
                    //to the query.
                    stmt = theConnection.createStatement(
                                      ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
                    //A "pre-compiled SQL statement that can be sent to the database.
                    //It is pre-compiled as the statements below will be executed many times on the database ie; when adding images.
                    PreparedStatement ps = theConnection.prepareStatement("insert into Table2 "  +"values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
                    ps.setInt(1, 2);
                    ps.setInt(2, 3);
                    ps.setString(3, "Jack");
                    ps.setString(4, "Fred");
                    ps.setString(5, "Bill");
                    ps.setString(6, "Sally");
                    ps.setString(7, "liverpool");
                    ps.setString(8, "holiday");
                    ps.setString(9, "christmas");
                    ps.setString(10, "december");
                    ps.setString(11, "nearby");
                    ps.executeUpdate();  //add the actual data to the database
                    theConnection.commit();
                    theConnection.setAutoCommit(true);
                    ResultSet uprs = stmt.executeQuery("SELECT * FROM Table2");//select all information from Table2
                    System.out.println("Table Table2 after insertion:");
                    ResultSetMetaData rsmd = uprs.getMetaData();
                    int numberOfColumns = rsmd.getColumnCount();
                    System.out.println("Total Columns " + numberOfColumns);
                    while (uprs.next()==true) //while there are more rows in the result set
                         int id = uprs.getInt("IMAGEID");
                         int total = uprs.getInt("TOTALPEOPLE");
                         System.out.print("ID  " + id);
                         System.out.println("Total People " + total);
                    //It is generally good practice to release resources as soon as you are finished with them to avoid tying up database resources.
                    uprs.close();     //close the result set object as only one can be open at a time, may use more yet
                    stmt.close();     
                    theConnection.close();
          } //end of try statement
          

Such an ugly looking post ... so hard to read.
Your problem is possibly due to the following:
1) AutoCommit is off
2) the same record is being added over and over again and the database contains no primary or unique key
;o)
V.V.

Similar Messages

  • I've already changed email for my apple id more than 6 months. But 2-3 months ago until now I've recieved and email to ask apple id confirmation from me. I never confirm anything because I don't know,the link's attached, it's legal or illegal.

    Dear Apple support team,
    I've already changed email for my apple id more than 6 months. But 2-3 months ago until now I've recieved and email to ask my apple id confirmation from me about 6-8 emails. I never confirm anything because I don't know,the link's attached, it's legal or illegal.
    The latest link (just be sent to my email 1 hr. ago) : http://www.smartpixeladv.com/proma/Login/index.html 
    Text is:
    Dear Customer,
    We recently noticed an unusual activity in your iTunes account. Please complete the process to confirm your
    informations.
    Confirm Now>
    This link will expire three days after this email was sent.
    If you don’t make this request, your account will be blocked for security reasons.
    Apple Support​
    In my opinion, i think      "http://"   should be   "https://"  right?  Or Apple should show the link on your website  that we can find, re- check and click by ourselve. Or  Apple should do "How to confirm apple id" on your main page. ( in fact  i'm not sure you already done "How to" on your website yes or not, because I cannot find it)
    The apple id is sensitive security, it's concerned personal security and any credit card payment so please understand me that's why i must to interrupt your team to help me to solve this problem. I'm scared my account will be blocked. Please advice me.
    Wassa. (BKK)

    It is a phishing attempt to get your Apple ID and Password.
    You should forward it to Apple : [email protected]

  • TS1702 why can't i update the app more than 50mb from itune but can throught wifi?

    I tried to update Apps more than 50mb through itune, but found the Apps which are needed to be update are mark "Downloaded" in iTune store.  Of course if the Apps mark "Downloaded" are not able to do anything with it.  On the other hand, I can simply use wifi to update the Apps, more than 50mb, throught my iphone instead of iTune.  Is there any problem with iTune or something wrong with my phone?

    In the App section of your itunes library ( NOT the sync pages) there is a button at the bottom which says Check for updates

  • HT1222 Hey, I've tried to install the new iOS 7.1 but it says that the installation cannot be completed and doesn't say why. I have more than 50% battery left but it still doesn't work, help?

    Hey, I've tried to install the new iOS 7.1 but it says that the installation cannot be completed and doesn't say why. I have more than 50% battery left but it still doesn't work, help?

    It probably means you don't have enough available storage on your phone.  It takes space to store the download - THEN unpack it.  Best method is to use a computer with iTunes (This allows you to back up on your computer as well). 
    PLEASE:  Do not purchase iCloud storage space - this will not give you more room for the iOS 7.1 installation.

  • I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    Plawexki wrote:
    ...  do you know if the contacts, photos, messages etc will be wiped?
    Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
    SYNCING with iTunes
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/
    You may find this information of interest...
    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • I got a new lenovo desktop windows 8.1,installed itunes and synced my ihone 4 no problems. then i imported a cd of songs which showed up in recently added but not in main library ,therefore it did not sync to the iphone. how can i get new songs to ap

    i got a new lenovo desktop windows 8.1,installed itunes and synced my iphone 4 no problems. then i imported a cd of songs which showed up in recently added but not in main library ,therefore it did not sync to the iphone. how can i get new songs to appear in the main library and sync properly
    thanks
    john

    Check the songs are really not in the Music section of the library by clicking the magnifying glass in the search box and unticking Search Entire Library if it is ticked, then typing in the name of the album. If the tracks still don't show try closing iTunes and deleting a hidden file called sentinel from inside your iTunes folder. This should make iTunes run an integrity check on the database when you start it again. Make sure the tracks are checked before you try syncing again.
    tt2

  • RegionRenderer encodeAll The region component with id: pt1:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance.

    Hi,
    I am using JDEV 11.1.2.1.0
    I am getting the following error :-
    <RegionRenderer> <encodeAll> The region component with id: pt1:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.
    Piece of code is for region is:-
       <f:facet name="second">
                                                <af:panelStretchLayout id="pa1"
                                                                       binding="#{backingBeanScope.Assign.pa1}">
                                                    <f:facet name="center">
                                                        <af:region value="#{bindings.tfdAssignGraph1.regionModel}" id="r1"
                                                                   binding="#{backingBeanScope.Assign.r1}"/>
                                                    </f:facet>
                                                </af:panelStretchLayout>
                                            </f:facet>
    How do I resolve it ?
    Thanks,

    Hi,
    I see at least 3 errors
    1. <RegionRenderer> <encodeAll> The region component with id: pt1:r1 has detected a page fragment with multiple root components.
    the page fragment should only have a single component under the jsp:root tag. If you see more than one, wrap them in e.g. an af:panelGroupLayout or af:group component
    2. SAPFunction.jspx/.xml" has an invalid character ".".
    check the document (you can open it in JDeveloper if the customization was a seeded one. Seems that editing this file smething has gone bad
    3. The expression "#{bindings..regionModel}" (that was specified for the RegionModel "value" attribute of the region component with id "pePanel") evaluated to null.
    "pageeditorpanel" does seem to be missing in the PageDef file of the page holding the region
    Frank

  • Hi, I like using Firefox more than I do IE, but I've been using IE lately because of all the pop-up pages I'm getting. Do you have any idea how I can stop thes

    Hi,
    I like using Firefox more than I do IE, but I've been using IE lately because of all the pop-up pages I'm getting. Do you have any idea how I can stop these pop-up tabs from happening?
    Thanks

    Do a malware check with some malware scanning programs on the Windows computer.<br>
    Please scan with all programs because each program detects different malware.<br>
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender: Home Page:<br>http://www.microsoft.com/windows/products/winfamily/defender/default.mspx
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • My iPad does not restart, I have kept the button for more than 10 seconds and will not turn off.  Please if anyone has any idea that I do, let me know. thanks

    My iPad does not restart, I have kept the button for more than 10 seconds and will not turn off.
    Please if anyone has any idea that I do, let me know.
    thanks

    Reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: You have to hold 2 buttons down together.

  • Can I have more than 8 themes added?

    In the older version of Firefox, you could install as many themes as you liked. But version 3.6.3, it seems you can only add 8 other than the default theme. I would like to know if I can add more than 8 themes. I did not know this and recently added new themes which replaced the old ones I had.

    As before, I can't reproduce this issue on my side, either with my own profile or with a new one. If, in your case, the new profile also has the problem, it points to an external factor that's triggering the bug. It's either a plugin (that get ported between profiles and are external to the browser, try disabling them all to check) or some kind of firewall/antivirus/security suite that's messing with Firefox... One thing's almost for sure: it's not something you can fix from inside Firefox if a new profile has the same problem.

  • BI 7.0 more than 2 clients possible or not ?

    Dear support,
    I am basis person and i have installed BI 7.0 netweaver 2004s system , also business content 7.03 are done.I have given 001 client as BWMANDT field in RSADMINA table which is required for initial config. Now system is working fine for deveopers. Now i need to connect one more customer to this BI system.
    And i need to provide access to them using different client apart from 001.
    I wanted to know is it possible to work in more than one client in BW
    If yes :---- should i add one more entry in rsadmina table , will RSA1 will work in that client too.......
    Best Regards,
    AjitR

    Chetan,
    I have 001 client set as BWMANDT filed in rsadmina . when i am trying to create new client it is allowing me to add entry but not allowing me login .
    what could be the reason?
    secondly if i am able to do client copy from 001 to new client
    do i need to add this new client to rsadmina table along with 001
    as i need both clients working as BW client.

  • Contact with more than two Addresses on Bold not all showing on device

    I have a blackberry bold and noticed that when i input more than 2 addresses in Outlook on the desktop, the 3rd one (called "other") shows up on the desktop but does not show on the handheld?  is this a bug or is there a trick to having all three addresses visible?  It seems odd to have the Other Option if it is i not able to be viewed remotely?  Many thanks for anyone's help here.

    You will need to "map" that other address field to your BlackBerry for syncing.
    1. Connect your BlackBerry® device to your computer.
    2. Open the BlackBerry Desktop Manager.
    3. Double-click Synchronize.
    4. On the Configuration tab, click Configure synch.
    5. Select the Address Book check box.
    6. Click Configure > Advanced Settings.
    7. Click Field Mapping.
    8. Map a field in the right column to a custom address book field in the left column.
    9. Click OK.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • While clearing document has more than 999 line items system not allowing

    Hi,
    We have an issue with FI-Customer Clearing. While clearing the error is appearing as document has more than 999 line items. after the detailed checking we found that there are lots of line items posted to Real Exchange Rate diff that to COPA.
    To reduce the maximum line items SAP is suggesting to deactivate the Real exchange rate diff.postings to COPA.
    Regards,
    R.Kumar.

    Hi,
    Please check SAP Note 1353125
    Thanks

  • My itunes library has organically grown from more than one itunes account but all now on a separate computer.  If I upgrade to iTunes match will I have to pay for each account?

    My itunes library has organically grown from more than one itunes account (all paid for by me) but all now on a separate computer.  If I upgrade to iTunes match will I have to pay for each account or just once, for the computer?

    No.  Provided the computer that you use to upload / match your Songs is authorised to play all of the Songs all works well - once complete you can download Song files that will play on your libraries / other computers without each computer having to be authorised.

  • ALV, sums, more than one WAERS, WAERS is not shown

    Hello,
    I have a problem:
    I have a table which contains WRBTR AND WAERS.
    There are more than one possible waers.
    So  I have a table for example:
    100   EUR
    1000 EUR
    500  EUR
    700  USD
    800  EUR
    The sum line looks like:
    2600 EUR
    700
    The second WAERS is missing.
    Why does the report show the EUR and not the USD?
    I want both WAERS.
    Any idea?

    Hi,
    Check this code it works fine.
    DATA : BEGIN OF WA_JESUS,
             V_NO TYPE I,
             V_M1(3) TYPE c,
           END OF WA_JESUS.
    DATA :  IT_JESUS LIKE HASHED TABLE OF WA_JESUS WITH HEADER LINE WITH UNIQUE KEY V_m1.
    IT_JESUS-V_NO   = 700.
    IT_JESUS-V_M1 = 'USD' .
    COLLECT IT_JESUS.
    IT_JESUS-V_NO   = 800.
    IT_JESUS-V_M1 = 'EUR' .
    COLLECT IT_JESUS.
    IT_JESUS-V_NO   = 700.
    IT_JESUS-V_M1 = 'EUR' .
    COLLECT IT_JESUS.
    LOOP AT IT_JESUS.
    WRITE : / IT_JESUS-V_NO,
              IT_JESUS-V_M1.
    ENDLOOP.
    Thanks,
    Reward If Helpful.

Maybe you are looking for

  • Need to populate an oracle table with the contents of ms-access table

    Dear All, I need a simple way to populate an oracle table from the table which is exist in ms-access mdb. Can we make some kind of constant link in between oracle db and ms-access db? So we will be able to perform this task whenever is required. Kind

  • I can't access iPhoto following my upgrade to yosemite

    i can't access iPhoto following my upgrade to yosemite

  • Guest networks in ACS 5.1

    Has any one added a guest network (wireless) within ACS 5.1 Have been looking at docs provided but am have=ing a difficult time getting it started.  Any suggestions would be helpful

  • Help Kernel_task eating CPU and MBP running hot since 10.6.3

    Hi Guys, Need some real help here. My laptop has become almost unusable here because the CPU goes up to 100% and the culprit is kernel_task. Ive noticed it slightly after installing 10.6.3. CPU runs up to 108c degrees Celsius. Ive tried reseting PRAM

  • T2000 SYS/REAR_FAULT

    Hi guys... I'm having a problem with REAR_FAULT led indicator on my front panel, which is lit on. You can see that from ALOM: alom> showenvironment =============== Environmental Status =============== System Temperatures (Temperatures in Celsius): Se