problem with ResultSet closed

Hello everyone. I wrote a code which supposed to find info on the user by its id to a few db. When I run my program it fails in the second loop on the line:

While (resultM.next ()) {}

the error is:

Exception in thread "main" java.sql.SQLException: operation not allowed after ResultSet class closed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:795)
at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7146)
at newpackage.db.findHistoryPatient(db.java:109)
at newpackage.db.main(db.java:29)

Thank you very much for help!

the code is:

Statement = connect.createStatement () (declaration);
Result set has the results of the SQL query

resultSet = statement.executeQuery ("select * from FEEDBACK.visit where the patient = '" + id + "'");

While (resultSet.next ()) {}
System.out.println ("the user is correct");
numH is a key to search for in history_medicines
String numH = resultSet.getString ("num");
String description = resultSet.getString ("description");

resultM = statement.executeQuery ("select * from FEEDBACK.history_medicines where id_visit ='" + Integer.parseInt (numH) + "'" "");

While (resultM.next ()) {}
int id_medicines = resultM.getInt ("id_medicines");
History = History.Concat (resultM.GetString("StartDate"). ToString()+ "-");
History = History.concat (resultM.getString ("endDate") +"'");
History = History.Concat (description + "");

ResultSet resultSetH = null;
resultSetH = statement.executeQuery ("select * from FEEDBACK.medicines where id = '" + id_medicines + "'");
While (resultSetH.next ())
History = History.Concat (resultSetH.GetString ("Name") +"'");
History = History.Concat (resultSetH.GetString ("Name") +"'");
String MedicinesName = findMedicinesName (resultM.getInt ("id_medicines"));

System.out.Print (History);

}

}

}
{Finally
Close();
}

user12163960 wrote:
OK thanks, but how can I solve this problem?
If in the first comic, I get all the id_visit and the second db I get all the info.

I'm not JDBC, but it seems to me that this is no longer a question of Java.

A single SQL SELECT with WHERE clauses can retrieve related records from all the tables.

Also, I recommend to use the PreparedStatement class and avoid the declaration.

DB

Tags: Oracle

Similar Questions

  • Problems with the closing of Skype

    Hello!

    Sometimes my Skype freezes, and I have problems to close. I want to close to restart!

    The only way to close it is to restart the computer unfortunately.

    What I tried:

    1. close icon in the tray (icon fades away, skype.exe still works)

    2. close by with the parameter Skype.exe/shutdown shortcut

    3. close task manager

    4. close by kill.exe by PCwelt

    Nothing has worked so far. Skype.exe is still running.

    I also tried to uninstall / reinstall. After uninstalling, I deleted the folder Skype %APPDATA%\microsoft\windows\sendto and %Temp%, but who wouldn't eiter.

    I'm on Windows 8.

    OK I figured it now! The problem was that I was still with Windows 8 instead of Windows 8.1. This problem is known to Microsoft and they suggest to do the update.

    After update, everything works great!

  • I have a problem with the closing work is not on the computer.

    Original title: Shutdown does not work completely

    I notice that my laptop was not actually shut down properly and my slow laptop. For me, I always leave my laptop sleep after that I go to bed or put me to sleep... and I realize that my laptop is slow... So I'll check what's happening... and I think my top time is 8 days so this means that my laptop was running 8 days non-stop... so I stop my laptop and check again and what happen it didn't reset high time and my laptop was totally slow... so I try to restart and the time taken has been reset. and my computer laptop back to normal, it runs smooth...

    The point is that we don't know what the judgment in fact do not? Shut down your laptop computer or PC will reset all default function, which means that all of your running application will be nearby. In this case the stop not reset all my app running at default.

    You can check by yourself:
    Select TASK MANAGER > PERFORMANCE and find the TIME 'UP', it appears like this "0:00:00:0" and the equivalent of days: hours: Minutes: second

    Hello

    It's because of the economy of functionality in Windows 8. By default, the computer is made to start or stop faster, which is not supported by most motherboards. Follow these steps and the PC starts normally.

    Windows 8 is a new feature called quick start. It can sometimes cause problems as you mentioned as well as others. The best way to know if the problem is to disable and see what happens.

    This feature works only when you make a STOP and then start. It does not affect a RESTART.

    To turn it off, follow these steps:

    1. press Windows key + X, go to the control panel > Power Options and select choose what the power buttons on the left.

    2. Select change settings that are currently unavailable, near the top center of the screen.

    3. lower in the window, uncheck the quick start.

    Hope this helps, keep us updated on the status of the issue.

  • I am expierencing problems with my isight Camera on my MacBook Pro. Suddenly the video camera does not start (no green light on) FT or Photo Booth. The screen is black, if I restart computer it works but after closing the lid, it stops. V10.11.3

    I have problems with my view i camera on my Mac Book Pro. Suddenly the video camera does not work (no green light on) FT or Photo Booth. The screen is black, if I restart it, it works but after closing the lid it stops and I have to restart the computer.  I use V10.11.3. An idea about what is happening

    Hello mpm068,

    Thank you for using communities of Apple Support.

    Since your iSight webcam works up to the time that your Mac goes to sleep, I would like you to start please help desk trying to replicate this problem then to reboot in safe mode:

    1. Choose the Apple menu > shut down.

    2. After your Mac stops, wait 10 seconds, then press the power button.

    3. As soon as you hear the startup tone, hold down the SHIFT key.

      You must press the SHIFT key as soon as possible once you hear the startup tone, but not before.

    4. Release the SHIFT key when you see the gray Apple logo and progress indicator.

    To exit safe mode, restart your Mac, but no press during the startup.

    OS X El Capitan: start in safe mode

    Take care.

  • Error - there is a problem with the external Setup program and it must be closed when you try to install windows updates

    Original title: How can I fix external MSI?

    When I try to download the updates, the error message says there is a problem with the external Setup program and it must be closed.  Updates will not be installed.  Anyone know how to solve this problem...?

    Hi John,.

    ·         You are able to install other applications on the computer?

    It seems to be a problem with the corruption of the .net framework. I suggest trying to repair the .net framework on the computer and see if you can install the updates.

    http://support.Microsoft.com/kb/923100

    Hope the helps of information.

  • 7 error "Paris 7.2.241.1enRegInstaller.exe of work and has been closed." A problem with the application to stop functioning properly. Windows will notify you if a solution is available.

    Original title - 7.2.241.1enRegInstaller.exe

    Hello.

    Today, JUST after I "Set Windows to update," twice, I got the disconcerting message:

    "Paris 7.2.241.1enRegInstaller.exe of working and was closed".

    A problem with the application to stop functioning properly.  Windows will notify you if a solution is available. »

    Any wisdom or experience with this?  I'm on a 64-bit HP Pavilion older (dv7-1245dx) with this OS JUST-update Windows (Vista Home Premium).

    Thank you.

    GIES W

    The solution has been found just uninstall bing bar, restart the computer, and if you want just bing toolbar to reinstall. This easy solution my system fixed.  Bing has again reminded all my points that I have amassed

  • Everyone has a problem with the Windows Explorer permanently closing?

    * Original title: Windows Explorer

    Everyone knows about a problem with the Windows Explorer (not Internet Explorer) without interruption closing? It is not fair on 1 computer, I have 2 desktops and 2 laptops, and it does on 4 of them. They are all running Windows 7, (1 to the publishing house, 1A Ultimate and 2 Professional).  I can right click on something, even on the desktop, and most of the time, I get a message that Windows Explorer has stopped and the ability to close or wait for it to respond. I have normally not 30 minutes or more to wait so that he could respond and if I close it, then it does nothing. I've done all updates are recommended for all my computers, I did the defragmentation, disk check, etc and it still continues. I need help, please. I am so sick and tired of what I am about to go to a Mac and I don't like Mac computers, but said there is much less of a problem.

    You have loaded all 3rd party "Add-ons" in common to all PC? For example (this is an old post Vista but gives the general idea) - http://answers.microsoft.com/en-us/windows/forum/windows_vista-desktop/windows-explorer-crashes-on-right-click/719385e6-fff5-498d-807c-103bf0344f44?page=1&tm=1423414000974 and see Ramesh respond.

    If not, is there clues in the log of events (errors) in common on all computers where the crash?

  • I just downloaded the new DC Acrobat, and I'm having a lot of problems with it. It's very, very slow. He has opening, saving, closing, do anything. Is there something that can be done to help him run a little more, well, normally?

    I just downloaded the new DC Acrobat, and I'm having a lot of problems with it. It's very, very slow. He has opening, saving, closing, do anything. Is there something that can be done to help him run a little more, well, normally?

    I fixed it! I used the string analyze function waiting in the Task Manager while opening a PDF file and have to wait 12 seconds... and it showed that the wait chain has been blocked by the Speech SDK. So I went to my Plugins of PDF from Adobe folder, which in my case is C:\Program Files (x 86) \Adobe\Acrobat DC\Acrobat\plug_ins and delete the plugin ReadOutLoud.api. (I had to close all instances of Acrobat DC first, and I had to also click the UAC Popup Windows application approval raised to remove the plugin) Now... instant Adobe Acrobat DC charge!

  • Windows 7 problem with closed captions.

    Hello.
    I had a problem with my Windows 7 subtitles.
    When I opened a fail .avi via Windows Media Player, Media Player Classic, BS Player, subtitles are not Bulgarian (I am Bulgarian), instead in a strange language.
    I downloaded VobSub - still the same.
    When I download an anime adaptation of some sort, subtitles are in English and not on a weird language.
    Please help me.

    I have VLC media player and has had a problem with Russian subtitles. I have changes in the encoding preferences: Cyrillic subtitles and it's all good! Velislav thanks!

  • macOS Sierra problems with screen sharing

    Hello

    After update to Sierra in two of my Macs, I can´t use the screen sharing. I used to use my second computer using screen sharing, but now, whenever I connect I see the split screen but active areas for use on as sleep, restart and turn off keep its original position. This means that if I like the closing down of the remote computer, I need to press just left... really strange sleep.

    I'm trying to connect to remote VNC Android and the appearance of the screen split also and with the same problem.

    Anyone has the same problem or an idea how to fix?
    Thanks in advance!

    Solved!
    Omission of base: after the descent of the Sierra update on both computers, forgot I manually start the.app after the update to the same date (a few minutes before). This cause the problem.
    I launch the.app server run OK and no problem with screen sharing.
    Maybe not to repeat this mistake, but just in case it's useful, I leave my explanation.

    See you soon,.

  • I have a strange problem with my RAM supported by installers. When I check the activity monitor, 3 installers are open and they start around 80 MB memory RAM used for about 7 or 10:08 minutes or so.

    I have a strange problem with my RAM supported by installers. When I check the activity monitor, 3 installers are open and they start around 80 MB memory RAM used for about 7 or 8 concerts after 10 minutes. I have to force them to quit, but I don't know what I am closing or why they open in the first place. Applications downloaded on iTunes?

    In addition, the Console has opened with the same message several times, but I don't know what that means.

    Any help would be appreciated.

    Hello

    The last is a picture of the Terminal window.

    Just because it lists 'Console' does not mean that it has nothing to do with this application.

    You have not said why or what you're trying to install so I can't help with that.

    You can use the activity monitor to leave their.

    After you select an item, use the X in a type of stop sign icon and confirm force quit.

    21:36 Thursday; September 15, 2016

     iMac 2.5 Ghz i5 2011 (El Capitan)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro (Snow Leopard 10.6.8) 2 GB
     Mac OS X (10.6.8).
     iPhone and iPad (2)

  • There is a problem with Firefox 'remembering' my Verizon residential account password. Using Firefox, I have to enter my username and password each time.

    There is a problem with Firefox 'remembering' my Verizon residential account password. Using Firefox, I am obliged to enter my ID and password every time I closed my browser and then restart or close my e-mail for a while, even though I checked the option "keep me connected" significant given by Verizon. I spent a lot of time today working with the technical support of Verizon and they (and I) can verify that it's specific to Firefox and IE is not the case. So far, this seems to be limited to the connection from Verizon, but there may be other affected accounts protected online. If it helps, I run Firefox under Windows 7 with Norton Security and the active Norton toolbar. It is a real pain and needs to be repaired.

    With the modules form filling;

    Go to the web site. After you enter data in a form, tell you the
    fill in form to remember what has been entered, save him form fill
    information based on the address of the site and the name of the
    field of that information was concluded. If the same field shows
    upward on a different page for the same site, or when you return to
    This page, the stored information is entered automatically
    For you. So far, I have not found a web page that prevents them from working.

  • Connection problem with the second monitor, macbook pro 2014, OSX El Capitan

    There are a few threads describing problems with two monitors, but I have not found a match.

    I like for the operating system ask login password once the lid is closed, no matter how much time has passed (even for a moment). Also, I work with a dual monitor. However, when my macbook is plugged into the monitor and I close the lid, the macbook don't disconnect but spends just primary monitors. Understand that this could be a feature and not a bug, I tried to unplug the monitor before closing the lid. But the OS seems not to realize that the monitor has been disconnected, and when I close the lid he didn't ask me for my password once that I reopen it. Does it also if I wait a bit (i.e. one minute) after disconnecting the monitor, but not if I wait a while (or 15 minutes), well that I've not enough highlighted how long is necessary so that it starts locking on my closing the lid. He does it with different monitors, so I doubt that it depends on the particular monitor. In both cases, I used the HDMI port.

    This is quite annoying, because I need to be able to disconnect safely in a short period of time, and I was not able to find a workaround on mine. Everyone knows this? Thank you for any help or advice.

    Emilio

    You might have invoked indevrtantly this obscure 'functionality' of MacOS. Read the article and see if you do these things:

    Use your Mac laptop to view closed with an external display - Apple Support

    .

  • problems with the firefox search engine

    When using my hotmail email today when I I closed it got stuck with the msn home page, I have managed to recover the firefox home page, but the search is made by BING, I don't want that I want as before google. It seems if be produced since firefox 18 was delivered

    Can any body help to get this back as before

    Try to reset default preferences with the SearchReset extension:

    Note that the SearchReset extension runs only once and then uninstalls automatically, so it will not appear on the page "> Firefox Add-ons" (topic: addons).

    You can check the pref browser.search.defaultenginename (s) on the topic: config page to see if it has the value of Google by default.

    If there is a problem with the search through the default value: home page and then try to reset the search engine used on the subject: homepage.

    Reset the pref browser.startup.homepage_override.mstone through the context menu by default on the topic: config page and close and restart Firefox to restore the on: default home page.

    1. Open the topic: config page through the address bar
    2. Type in the filter bar: mstone
    3. Right-click on the browser.startup.homepage_override.mstone line, and then select: Reset
    4. Close and restart Firefox

    If this did not help, then remove the button Delete the chromeappsstore.sqlite file in the Firefox profile folder and repeat the foregoing.

  • Problem with Radio App on my Journe touch

    Hello, once again...: D

    I have a problem with my app Radeo on my tablet, and I'm not able to fix it on my own...
    When choosing a radio station to listen to, I always find myself waiting for a few seconds for the station to load ("open..." next to the icon of the station at the bottom right of the screen), then get the same message "error"...

    I already updated the app from the online store, but nothing has changed...
    And I have this problem with all the simple radio stations that I choose...

    I tried searching the forums and google search, but I can't find any solution or even reports on the problem...

    So, is this just a problem of my tablet, or I'm not the only one?

    Thanks in advance!

    Hi christine

    A few months ago, I talked to the AEP from Toshiba on the availability of app touch trip and he told me that some of the travel apps will not work because the trip touch isn t no longer supported, I guess that the application of the radio no longer works because the server was closed and so the application can not find any radio station.

    What to say journey touch is an old device with archaic system that is Windows CE. There is not a lot of apps for this OS and I don't expect that applications Windows CE would be released in the future.

Maybe you are looking for

  • Restrictions keep the reset music to "clean up".

    I bought an iPod a few years ago, when I became a Zumba instructor, because I thought it would be the best way to manage the music for my class.  But it's extremely annoying (not to mention embarrassing) when the iPod fails a song and I have to stop

  • El Capitan Tags

    Is there a way to change the color of the tags on El Capitan. There are eight colors and I know that you are able to create and rename your own label, but is there a way to make a custom color?

  • How to connect to your Windows XP computer if I forgot my password?

    Original title: forgotten password I forgot the password. IM the administrator screen in safe mode, what I do now?

  • Color Laserjet CP5525 will not come on loan

    Printer will not loan and the error log has 49.2F. E3. From what I could find, this is a firmware error. But how I've updated the firmware if the printer will not come on loan?

  • Wireless does not work during recovery.

    I don't get very far with my recovery system. I have a HP Pavilion dv7 3065 dx with Windows 7 64 bit Home Premium edition. My Wi - Fi connection works normally, but in the Recovery Manager all I can get is the orange light. I get to a screen in which