ResultSets Closing, cant use .last() etc

I am filling 3 seperate resultsets using 3 seperate sql queries.
The 1st query calls the connection classes setData() and passes in the sql statement, which connects, gets the data, puts it in a resultset, and returns it to the calling class. Then, the returned resultset copied into resultset1.
The 2nd query then does the same thing, but its sql statement is getting different data from a different table, but it still uses the getData() method to do it. It then fills resultset2.
Then the 3rd query runs its sql query the same way to fill resultset3.
The problem is, after i have filled resultsets 1, 2 and 3, it wont let me call a .first() or .last() on any of them cause it says that the resultset is closed! Heres the exact error msg:
"java.sql.SQLException: Operation not allowed after ResultSet closed"
Heres the code where i try fill the 3 resultsets:
          mycon = new MysqlConnect();
               details_res = mycon.getData("SELECT * FROM details ORDER BY details_id");     
               details_res.last();
               parts_res = mycon.getData("SELECT * FROM parts ORDER BY parts_id");               
               parts_res.last();
               costs_res = mycon.getData("SELECT * FROM costs ORDER BY costs_id");
               costs_res.last();'mycon' is an object of the connection class.
So im guessing that ive got a problem in the getData() method of the connection class so heres the code for that method:
     public ResultSet getData(String query)
          connect();
          try
               // browseable in all directions, not sensitive to updates by other users, not updateable
               stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // create empty SQL statement
               // execute SQL query & store results
               result = stmt.executeQuery(query);
               con.close();        // close connection
               System.out.println("Data Retrieved. Connection Closed");
          catch (SQLException e)
               System.out.println("SQL Exception " + e);
          return result; // return the data
     }//end getData()'stmt' and 'con' are both declared at the top, private variables.

Right. Exactly. This is the way it's supposed to be. You've got major fundamental flaws in your approach.
First, the result set is not being copied, you're creating a new reference to it.
Second, result sets AREN'T copied.
Third, a ResultSet represents an arbitrarily large flow of data that will come throw the connection as you step through elements in the ResultSet; as soon as you close the connection, you cut off the flow.
So the excpetion is exactly right, you've closed the flow and therefore can't move around in the ResultSet.

Similar Messages

  • Suddenly with version 9 and 10 i cant use the shortcut command of ctrl+shift+t to open the most recently closed tab.

    Suddenly with version 9 and 10 i cant use the shortcut command of ctrl+shift+t to open the most recently closed tab. a feature used several times a day, previously. This is very Frustrating to me, i have tried looking up a tool keyconfig 20110522 and looked that it says that ctrl+shift+t is the right command, but i still cant use it WHY oh WHY?? if i could get some help figuring this out it would be so awesome, cause i love Firefox, been using it almost daily for the last 10 or so years and i don't intend to switch soon.

    Hi,
    Please check if this happens in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode.] This is a temporary diagnostic session and you can exit anytime and start Firefox normally again. This session disables all the '''Extensions''', themes ('''Appearance''') and '''Plugins''' in '''Tools''' ('''Alt''' + '''T''') > '''Add-ons'''.
    [http://kb.mozillazine.org/Problematic_extensions Problematic Extensions]
    [https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes Troubleshooting Extensions and Themes]
    [http://support.mozilla.com/en-US/kb/Uninstalling+add-ons Uninstalling Add-ons]
    [http://kb.mozillazine.org/Uninstalling_toolbars Uninstalling Toolbars]

  • HT204350 I have a Mac Book Pro with 10.6.8 and want to back up my files using a flash drive.  It says I did it but when I tried to check on my other Mac - an I Mac with 10.5.8, thedata does not seem to be there.  I cant see photos, etc.

    I have a Mac Book Pro with 10.6.8 and want to back up my files using a flash drive.  It says I did it but when I tried to check on my other Mac - an I Mac with 10.5.8, thedata does not seem to be there.  I cant see photos, etc..  It shows the backup as a file and shows various system info.  but there are no photos or other files shown.
    Thanks for any advise.
    Mike

    A PowerPC Mac, if that's what it is, won't be able to see an Intel Mac's formatted data.  Also ExFat formatting is not supported by 10.6.3 or earlier.  I would try viewing the backup on another Intel Mac with at least 10.6.4.  If it isn't there, then the backup never really took place.  I much profer a hard drive with Carbon Copy Cloner.

  • Cant use my iMessage in my macbook pro and receive my last emails

    i cant use my imessage in my mac cause its say that :   message cant log in to my email cause my login ID or pasword is incorrect
    but when i try to get ito my email account i can opened, the problem is only in my macbook pro.  the other problem is the last sync i did with my old iphone 3s to my macbook pro it show the emails of years ago but not the recent emails that i received also in my 4s iphone. So i dont know how to fix the problem, is it i have to change in someplace of the macbook pro the new password of my email account to receive and sync the last mails? how?

    Hello perl@
    Start your troubleshooting with the article below to activate iMessage on your Mac. Check to see if you can log in to the appleid.apple.com to access your account to see if it needs verification.
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/ts3970
    Regards,
    -Norm G.  

  • HT1937 why i cant use my credit card when im purchasing in clash of clan of gems always say your purchase could not be completed etc etc

    why i cant use my credit card when im purchasing in clash of clan of gems always say your purchase could not be completed etc etc

    No one here can help you.
    Go here:
    https://getsupport.apple.com/GetproductgroupList.action
    ask for assistance.

  • Hi helpers I have very old MacBook 10.5.8 please could you tell me what operating system I should get to be able fully use my laptop as i cant use it properly anymore and doesnt connect with my Iphones etc thanks

    Hi helpers I have very old MacBook Mac OS X 10.5.8 please could you tell me what operating system I should get to be able fully use my laptop as i cant use it properly anymore and doesnt connect with my Iphones etc thanks

    Josejanko,
    You don't supply much info other than your machine is old, so here is some info for you to check thru.
    Before doing anything you should have a back up, preferably 2, in the event something goes wrong.
    You would have to start by upgrading to Snow Leopard, you would need to buy the disk for about $20 here  http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard  
    Check the the requirements to see if your machine meets them.
    You would then need to run the 10.6.8 v1.1 combo update to get it to 10.6.8 Mac OS X 10.6.8 Update Combo v1.1
    You can then access the APP STORE and possibly upgrade to to further OSX.
    You may have applications that will not be compatible with any thing past Snow Leopard, you can check those here Upgrading to 10.7 and above, don't forget Rosetta!
    http://roaringapps.com/apps
    Office 2008 will not work with anything newer than Snow Leopard for an wxample
    You may be able to upgrade to Lion or MT Lion or Yosemite, depending on your machine, from the APP STORE.
    OS X Lion - Technical Specifications Lion
    http://store.apple.com/us/product/D6377Z/A/os-x-mountain-lion Mountain Lion
    http://www.apple.com/osx/how-to-upgrade/ Yosemite
    Hope this helps you

  • Hi, my IPAD was stolen last April 30, 2014 here in the Philippines. Is there any way how to locate or LOCK it so anybody cant use it? Thank you

    Hi, my IPAD was stolen last April 30, 2014 here in the Philippines. Is there any way how to locate or LOCK it so anybody cant use it? Thank you

    Here is some guidance ...  What to do if your iOS device is lost or stolen
    And some more ...              Reporting a lost or stolen Apple product
    Remember, take a note of the incident number when you have reported it to the police ... without that, any domestic insurance claim will not receive attention.

  • How do I transfer an app from itunes my pc to my iphone 4s? I cant use wifi as my chip fried at the last update

    How can I transfer an App purchased on iTunes on my pc to my iPhone 4s. I have tried synching but this does not make the app appear on my iPhone. I cant use wifi as my chip was fried on the latest update.

    When you tried syncing, did you connect the phone, then click on the phone icon near the top left of iTunes, then click on Apps under Settings in the sidebar, then find the app in question and click the Install button beside it before clicking Sync at the bottom right?

  • After downloading OSX Maverick you then cant use work. excel or powerpoint. What do i use and how can i recall my word documents etc

    After downloading OSX Maverick you then cant use work. excel or powerpoint. What do i use and how can i recall my word documents etc

    Use Office for Mac 2011.  If you have it, open one of the programs (Word, Excel, PowerPoint) and do Help > Check for Updates from the menu.
    Otherwise, purchase Office 365 and use that.

  • Lots of free space that I cant use 5c

    Hi,
    I have a iphone 5c, and I can only put a small amount of music on it. There is months of music on my computer, but when I 'autofill' it only puts about a hundred songs on. Afterwards there is about 5gB of free space on my phone. I also cant update apps etc as it thinks there is no free space left. I have checked I am not resrving this space for free space in the settings and I have done a software update to 8.2 and also a restore, but no joy. Why is it doing this?

    You need an external disk that is formated as HFS+ with a GUID partition map.
    You can use either Carbon Copy Cloner or SuperDuper to create the clone.
    Once ypu have the clone you can boot from my holding down the option key ater power on.
    Once booted from the clone open Disk Utility.
    Select the internal drive.
    Click partition.
    Select single partition.
    Once drive has bee formated, restore the clone nack with the application used to make the original clone.
    Boot from internal drive.
    Allan

  • HT201359 why i cant use my apple id ?

    help me plz i cant use my apple id

    Not enough information.
    You need to give us a detailed explanation of exactly what is happening; how you are trying to use the ID, what alerts you see when you try, etc.

  • JDBC + MySQL : "Operation Not Allowed After ResultSet Closed"

    I have a very short piece of code. I use one connection to the database. I execute a query, get back a lot of rows, then iterate through the result set and for each row I get some information and then perform an insert into a different table.
    The problem is that the big result set I am iterating through keeps closing sometime during the first iteration. Why? I am using three different statements:
    1) Statement 1 is for the main query I want to iterate through
    2) Statement 2 is for a quick lookup I perform (on a different table) for each item in the iteration.
    3) Statement 3 is for the Insert statement which I perform for each item in the iteration. Again, I insert into a different table and I use "executeUpdate"
    Given the I have three different statements and I am working with three different tables, why does my main result set that I am iterating through keep closing on me?
    Here is the error I am getting:
    java.sql.SQLException: Operation not allowed after ResultSet closed
    at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:3603)
    at com.mysql.jdbc.ResultSet.next(ResultSet.java:2468)
    at com.mysql.jdbc.UpdatableResultSet.next(UpdatableResultSet.java:565)
    Thanks for your help.

    I have a very short piece of code. I use one
    connection to the database. I execute a query, get
    back a lot of rows, then iterate through the result
    set and for each row I get some information and then
    perform an insert into a different table.Sounds like a classic case of making Java do what the database was made to do.
    I'd bet you can do this in a single INSERT with a SELECT in the database in one network roundtrip. The "quick lookup" might be a JOIN or a sub-SELECT. When you do a query, bring N rows back to the middle tier, then do an INSERT for each row that you retrieve it means (N+1) network roundtrips if you don't batch your INSERTs. I'd have a SQL expert give your code a look.
    The problem is that the big result set I am iterating
    through keeps closing sometime during the first
    iteration. Why? I am using three different
    statements:
    1) Statement 1 is for the main query I want to
    iterate through
    2) Statement 2 is for a quick lookup I perform (on a
    different table) for each item in the iteration.
    3) Statement 3 is for the Insert statement which I
    perform for each item in the iteration. Again, I
    insert into a different table and I use
    "executeUpdate"
    Given the I have three different statements and I am
    working with three different tables, why does my main
    result set that I am iterating through keep closing
    on me?Maybe your ResultSet or Statement goes out of scope. Do the Statements share a Connection?
    %

  • Cant use more than one authorization group per report with SBO CR Basic

    Cant use more than one authorization group per report with SBO CR Basic.
    I have installed on SAP Business One SBO 2007 SP00 PL49 the Crystal Reports Basic 2.0.0.7.
    i have defined two users, manager and supervisor.
    I have defined two groups, M and S.
    Manager belongs in managers (M), and supervisor is assigned to the supervisors (S).
    i enter to one report, disable the public option to enable group authorization, and then check M group.
    Manager can see the report, but Supervisor is not allowed. So far good.
    Then i uncheck M, then check S in the report properties, and Manager cant get in, supervisor opens the report, So far good.
    But when we check both Groups or more, only the M group authorization appears to work, and S group users cant acess, even the report is allowed for that group, also happens with all the groups appart the first (2nd, 3rd, 4th, etc.).
    It seems that a report can manage a single group, but i have to be shure to tell this to the customer.
    So far we have included all Manager users to the S group in order that only S group is used and authorized users can use, but this is duplicating user participation in groups, and it would be much easier to check the desired groups for a single report.

    Cant use more than one authorization group per report with SBO CR Basic.
    I have installed on SAP Business One SBO 2007 SP00 PL49 the Crystal Reports Basic 2.0.0.7.
    i have defined two users, manager and supervisor.
    I have defined two groups, M and S.
    Manager belongs in managers (M), and supervisor is assigned to the supervisors (S).
    i enter to one report, disable the public option to enable group authorization, and then check M group.
    Manager can see the report, but Supervisor is not allowed. So far good.
    Then i uncheck M, then check S in the report properties, and Manager cant get in, supervisor opens the report, So far good.
    But when we check both Groups or more, only the M group authorization appears to work, and S group users cant acess, even the report is allowed for that group, also happens with all the groups appart the first (2nd, 3rd, 4th, etc.).
    It seems that a report can manage a single group, but i have to be shure to tell this to the customer.
    So far we have included all Manager users to the S group in order that only S group is used and authorized users can use, but this is duplicating user participation in groups, and it would be much easier to check the desired groups for a single report.

  • TS1702 why i cant use the PAges, Numbers, Keynote, Garageband that i bought on my ipad2 on my new MackBook Pro?

    Happy New Year 2013 to you all lucky Mac users ;-)
    I have a iPad2 since last year and bought these apps "Pages, Numbers, Keynote, Gargaeband" on it. Now i have a new MackBook Pro 17" quadcore i7 OS 10.7.5 and trying to sync my apps and use them on my Macbook Pro but for some reason i can not...
    Would you please help me out how to do it and where to start?
    I know that once you bought an app you can sync and use them on all your devices, but how? The price on above apps for iphone and ipad are much cheaper than for macs. Is this the reason i cant use them on my macbook pro?
    Thanks for your help.
    OMG That's It

    Welcome to the Apple Support Communities
    You can't use apps purchased on the iPad on the Mac. They use different App Stores and iPad apps aren't compatible with Macs, so you have to purchase them in the Mac App Store

  • HT1338 for itunes 10.7 it is saying that my mac need version OS X needs to be version 10.8.6 - how do i get this? There are no current software updtes and i cant use iTunes for my new iphone 5

    For itunes 10.7 it is saying that my mac need version OS X needs to be version 10.8.6 - how do i get this? There are no current software updates and i cant use iTunes for my new iphone 5

    I think you meant 10.6.8, not 10.8.6
    It requires an upgrade, instead of a free update.
    Snow Leopard/10.6.x Requirements...
    General requirements
       * Mac computer with an Intel processor
        * 1GB of memory (I say 4GB at least, more if you can afford it)
        * 5GB of available disk space (I say 30GB at least)
        * DVD drive for installation
        * Some features require a compatible Internet service provider; fees may apply.
        * Some features require Apple’s MobileMe service; fees and terms apply.
    Which apps work with Mac OS X 10.6?...
    http://snowleopard.wikidot.com/
    It's been pulled from the online store & Apple Stores, so you have to call Apple to buy it, last I heard.
    Buy Snow Leopard > http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard
    Call Apple Sales...in the US: 1-800-MY-APPLE. Or Support... 1-800-275-2273
    Other countries...
    http://support.apple.com/kb/HE57

Maybe you are looking for

  • Mixing RAM Speeds In iMac G4 1GHz 17" Flat-Panel?

    I'm just checking here. I have an iMac G4 1GHz 17" Flat-Panel, Model M8935LL/A (USB 1.1 version) that currently has the standard 256MB PC2100 (266 MHz) RAM module installed in the factory slot, and a 512MB PC2700 (333 MHz) RAM module installed in the

  • XML imported from iM '08 has a different aspect ratio in FCP 6?

    I have the new canon vixia hg 21 which is avchd and FCP 6 isn't recognizing it. Using Imovie to recognize the files works fine, the problem is that when you export from imovie '08 into FCP via xml, it imports fine, but I get a display issue with blac

  • How can I count the number of unique cells?

    I have a column in my spreadsheet that looks like this: Date Items 3/25 Item A 3/27 Item A 3/29 Item A 3/25 Item A 4/25 Item B 6/1 Item B 7/13 Item B 8/9 Item B 3/5 Item C 1/2 Item C 5/15 Item D 3/25 Item D What I want is something that will list all

  • Balance in transaction currency - during J1IV for retrun delivery

    I have did migo with 101 mov type and later, client has returned the same material and qty via 122. I couldn't get part 2 tab in return delivery screen. In this, I have did J1IS and unable to post thru  J1IV ,  where i'm getting an  error msge "Balan

  • ORDER A PRINT ONLINE OF A SQUARE PHOTO IN IPHOTO

    How can I order a print of square photos in IPHOTO without them cropping it out as it happened, instead of scaling it down to fit the paper and leave a white border as I assumed they would do?? MACCBOOK   Mac OS X (10.4.8)