How can i deal with this problem

For example, In my database, there are three records:
field : a b c
a.txt c:/a.txt adsfs
b.txt c:/b.txt asdfsf
c.txt c:/c.txt asfdsf
Now I open one file b.txt to check the database whether have the same filename,filepath, hash value.
the results display:
The file: b.txt has not been registered
The file: c://b.txt appears OK
The file: b.txt has not been registered
I want to do is to only shows the results of 'The file: c://b.txt appears OK'. I know the problem is the body of while(rs.next).
is there any best way to conform to my demand
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:MD5";
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql="SELECT * FROM MD5";
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
if (file.getName().equals(rs.getString("a")))
  if (file.getPath().equals(rs.getString("b")))
  if (m.equals(rs.getString("c")))
    jTextArea2.append("The file: " + file.getPath() +"appears OK"+"\n");
else jTextArea2.append("The file: " + file.getPath() +"has been modified"+"\n");
else jTextArea2.append("The Path for the" + file.getName() +"has been modified"+"\n");
else jTextArea2.append("The file: " + file.getName() +"has not been registered"+"\n");
rs.close();
connection.close();
}

Why not add a WHERE clause to your statment to filter records having the name of the file in the first record. In this case you'd better use PreparedStatement and set the file name as statement parameter
Because now you loop through the entire table for a thing you can deal with at DB level.
And I agree with the others' remarks about those braces ;)
Mike

Similar Messages

  • It says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    I just got my new iPad Mini2, and when I choose "sign in with your apple ID", it says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    1. Turn router off for 30 seconds and on again
    2. Settings>General>Reset>Reset Network Settings

  • HT5621 I have moved permanently from the US to live in the UK. when I try to download a UK app I am often told that I cannot use a UK Apple sstore, only a US store. I need to access various UK stores how can I deal with this?

    I have moved permanently from the US to live in the UK. when I try to download a UK app I am often told that I cannot use a UK Apple sstore, only a US store. I need to access various UK stores how can I deal with this?

    Try here
    http://support.apple.com/kb/HT1311
    when you have UK Cards etc best to change as well

  • TS1436 I received this message twice on 2 new & separate attempts to burn a playlist to a NEW cd:  "The attempt to burn a disc failed.  The burn failed because of a medium write error."  What is a "medium write error" and how can I deal with this?

    I received this message twice on 2 new & separate attempts to burn a playlist to a NEW cd:  "The attempt to burn a disc failed.  The burn failed because of a medium write error."  What is a "medium write error" and how can I deal with this?

    Hello Pat,
    The following article provides troublehsooting steps and information that can help get iTunes burning discs again.
    Can't burn a CD in iTunes for Windows
    http://support.apple.com/kb/TS1436
    Cheers,
    Allen

  • Hi apple am new user to apple i just bought i phone 4s  and  i set up passowrd and forgot it how  and the iphone is not responding now how can i deal with this broblem please helpe

    hi apple am new user to apple i just bought i phone 4s  and  i set up passowrd and forgot it how  and the iphone is not responding now how can i deal with this broblem please helpe

    iPhone User Guide (For iOS 5.1 Software)

  • TS4009 in my email account, the mobile me account appears with a circle to the left indicating it is not active- How can I deal with this

    my icloud account or mobile me account is inactive
    how can I resume receiving email messages to my me.com account?
    all mail is being returned or rejected

    Sign out in System Preferences>iCloud and sign back in again.

  • How can I deal with this installing problem????

    Exit Code: 6
    Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW050 ... WARNING: DW016, DW024 ...
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 7 error(s), 3 warning(s)
    WARNING: DW024: The payload: {9124DF4E-617D-486B-A970-8FA632244F24} Adobe Photoshop CS6 Core 13.0.0.0 requires a UI parent with following specification:
    Family: Photoshop
    ProductName: Adobe Photoshop CS6 Core_x64
    This parent relationship is not satisfied, because this payload is not present in this session.
    WARNING: DW016: NOTE: Cannot set action to the payload {B8ADDCBD-30D9-4366-AE25-089CEF76C8E1} Suite Shared Configuration CS6 3.0.0.0 as it is already upgraded by the payload {8706963D-5F48-47CC-998B-DAB70B089DB8} Suite Shared Configuration CS6 3.0.0.0
    WARNING: DW016: NOTE: Cannot set action to the payload {B8ADDCBD-30D9-4366-AE25-089CEF76C8E1} Suite Shared Configuration CS6 3.0.0.0 as it is already upgraded by the payload {8706963D-5F48-47CC-998B-DAB70B089DB8} Suite Shared Configuration CS6 3.0.0.0
    ----------- Payload: {9E0AF030-AC6B-11E0-8837-00215AEA26C9} Microsoft Visual C++ 2010 Redistributable Package (x86) 10.0.40219.1 -----------
    ERROR: Failed to repair Microsoft Visual C++ 2010 Redistributable Package (x86). Please try repairing it by double clicking on the executable at "D:\AdobePS\Adobe Photoshop CS6 Extended\Adobe CS6\payloads\Microsoft VC 2010 Redist (x86)\vcredist_x86.exe", or download and install the latest Microsoft Visual C++ 2010 Redistributable Package (x86) from Microsoft website - www.microsoft.com
    ----------- Payload: {7E91BB17-16A1-42CE-9502-D6C98BE04920} PDF Settings CS6 11.0.0.0 -----------
    ERROR: AMT Operation failed with status code 1 for file C:\Program Files\Common Files\Adobe\Linguistics\6.0\Providers\Plugins2\AdobeHunspellPlugin\AMT\component.xml
    ERROR: AMT Operation failed with status code 1 for file C:\Program Files\Common Files\Adobe\Linguistics\6.0\Providers\Plugins2\WRLiloPlugin1.3\AMT\component.xml
    ERROR: AMT Operation failed with status code 1 for file C:\Program Files\Common Files\Adobe\FontsRecommended\2.0\AMT\component.xml
    ERROR: AMT Operation failed with status code 1 for file C:\Program Files (x86)\Adobe\Adobe Bridge CS6\AMT\application.xml
    ERROR: AMT Operation failed with status code 1 for file C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\AMT\application.xml
    ERROR: DW050: The following payload errors were found during install:
    ERROR: DW050:  - Microsoft Visual C++ 2010 Redistributable Package (x86): Install failed

    http://helpx.adobe.com/creative-suite/kb/errors-exit-code-6-exit.html
    Mylenium

  • How can I Deal with this 2 errors?

    I'm so desperated I can't even run the HelloWorldApp, because it has this error in the interpreter (I compiled it and Zero erros):
    Exception in thread "main" java.lang.NoClassDefFoundErros
    and in other program I have this
    Exception in thread "main" java.lang.NoSuchMethodError: detail.number () at Factorial.main
    But I DO have a method named number which has been inclosed in the object detail.
    Please Help Me! I'm really Frustrated (hey, you may be like me if HelloWorldApp doesn't evev runs!!!)

    I'm so desperated I can't even run the HelloWorldApp,
    because it has this error in the interpreter (I
    compiled it and Zero erros):
    Exception in thread "main"
    java.lang.NoClassDefFoundErrosYou did compile your file using "javac" correct?
    And you are not using "package" in your source code correct?
    Once compiled you need to be in the directory where the class file is.
    and in other program I have this
    Exception in thread "main"
    java.lang.NoSuchMethodError: detail.number () at
    Factorial.main
    But I DO have a method named number which has been
    inclosed in the object detail.No you do not. What that error says is that at that particular point it can not find a method that matches the way you are using the method.
    That could be because the method doesn't exist. Or because the signature is wrong. Or because it is private and it needs to be public. Or because it is not part of "detail" but is part of something else.

  • My iPad is connected to wifi,but every several minutes later,I just can not connect to webpage,then I have to shut off iPad and turn it on again,and several minutes later the same thing happens again,how can I deal with this?

    Why I can not go to webpage even wifi is on?it happens every 6 minutes.......

    Is it the same webpage everytime?  And is it exactly 6 minutes?
    If you have control over the modem and wifi router, i.e. your personal router in your home, I would powercycle your modem and router and see what happens.
    1.  unplug the wifi router's power cord
    2. unplug the modem's power cord
    3. wait 10 - 15 seconds (I usually wait about a minute)
    4. plug the modem back in and wait for it to stabilize
    5. plug the router back in and wait for it to stabilize
    6. try to to to the web page again.
    And while I am waiting for my modem to start back up and get itself connected to the internet I usually restart my iPad/iPhone.  Hold the Home button and the Power button down at the same time, wait for the apple logo to appear and then wait for the device to to a restart.  Very much like rebooting your PC.

  • I often get the error message af604005 when I try to email someone by clicking on a website link. How can I deal with this please?

    At http://www.ehow.com/video_4985518_stop-internet-explorer-script-error.html I found what looked like a promising bit of advice for Internet Explorer users but I wasn't sure how to adapt it for Firefox.

    Run it in compatibility mode and input the credentials.
    Mylenium

  • How can I deal with long sql by the oo4o?

    I am using VB and oo4o to develop a sql executor which is a extention of an old system.
    For some reason, I have to use oo4o v8.1.7 to deal with Oracle Database 8i to 11g.
    But when I send a very long sql(11KB) to it I got a error in the VB enviroment.
    The Err.Description is "automention error. Started object is disconnected by the client.".
    The Err.Number is "-2147417848 ".
    The sql that I send it to the program is a simple select sql that like select a, b, c, substrb(d, 1, 2), substrb(e, 2, 3) .... from A_TBL where A=aa;
    This sql is normally executed by the sqlplus but I got an error by the oo4o.
    When I insert a '' between the 30Xth items, it got exectuted normally.
    ex. select a, b, c, substrb(d, 1, 2), substrb(e, 1, 2) ..... substrb(303th, 3, 4), '', substrb(304th, 1, 2) ... from A_TBL where A = aa;
    How can I deal with this problem? Thanks.

    So how can use this function correctly?By learning what exceptions are, how they're used, and what you can do to deal with them. There's a tutorial here: http://java.sun.com/docs/books/tutorial/essential/exceptions/index.htmlAnd here's a quick overview:
    The base class for all exceptions is Throwable. Java provides Exception and Error that extend Throwable. RuntimeException (and many others) extend Exception.
    RuntimeException and its descendants, and Error and its descendants, are called unchecked exceptions. Everything else is a checked exception.
    If your method, or any method it calls, can throw a checked exception, then your method must either catch that exception, or declare that your method throws that exception. This way, when I call your method, I know at compile time what can possibly go wrong and I can decide whether to handle it or just bubble it up to my caller. Catching a given exception also catches all that exception's descendants. Declaring that you throw a given exception means that you might throw that exception or any of its descendants.
    Unchecked exceptions (RuntimeException, Error, and their descendants) are not subject to those restrictions. Any method can throw any unchecked exception at any time without declaring it. This is because unchecked exceptions are either the sign of a coding error (RuntimeException), which is totally preventable and should be fixed rather than handled by the code that encounters it, or a problem in the VM, which in general can not be predicted or handled.

  • My iphone was disable and it say connect to itunes. but when i connect it to my computer, my computer cant detact my device. how do i deal with this situation?

    hi, i have a problems. my iphone is being disable after my daughter play with it and been entering all the wrong code. so my iphone is now disable and it say connect to itunes. i already plug my iphone to my computer, how ever my computer could not detact my devic. and because of that i cant connect it to my itunes. how do i deal with this problems?

    iOS: Device not recognized in iTunes for Windows

  • HT1420 I purchased new computers twice within the same year because they old were damaged in a storm.  However, I can't deauthorize/reauthorize the new computers.  How do I deal with this situation.

    I purchased new computers twice within the same year because they were damaged in a storm.  However, I can't deauthorize/reauthorize the new computers because it has been less than a year.  How do I deal with this situation?

    BrianBlaze wrote:
    I have 3 Computers at home, I am studying computer sciences and am constantly rerformatting my computers, installing windows and linux over and over again.... EVERYTIME I reformat I have to authorize the same computer and so it takes up one of my 5 authorized computers... Anyways after deauthorizing all my computers in september I was not aware I couldn't do it for another year (why does APPLE assume these stupid tactics prevent piracy). Anywysw I need to reach apple and have them make it so I can do it again. I had a similar problem with Playstation and when I called them they fixed it for me... even windows (which you can only have one serial per computer) made it easy because all I had to do was call them and they fixed it for me. Now I need APPLE to do the same and this is the only place I could see to actually say what is going on... I can't believe I have to do this with my iPhone... I wanted an mp3 player and a phone together and if I can't put new songs until September 20, 2012 I am going to freak out!
    HELP!
    Brian
    Try this link: http://www.howtogeek.com/howto/23974/beginner-deauthorize-all-computers-associat ed-with-your-itunes-account/

  • How to deal with this problem?

    How to deal with this problem?
    We plan to use Oracle Coherence (In Memory Data Grid) for a large-scale application. In order to keep the database table data in Coherence caches, we will create all the corresplonding Java objects (entities) and construct the persistence system using JPA/EclipseLink+JDBC. In this way, any in-memory object update will be persisted to the corresponding database tables.
    The problem is that some existing application codes are updating these database tables directly now. If the direct-database-table update is not permmited in the persistence environment, we have to discard most of the existing application scripts.
    I want to know, in this situation, should I discard most of the existing scripts?
    Are there any other solutions?

    Allowing writes from both cache & DB is possible with its own set of issues.
    The main issue to consider is conflicts from updates on same record via both cache and DB. If your caches are write-through the conflict decreases - but then cache writes become slower. If your caches are write-behind potentially the older cache update will overwrite the latest DB update. Now you are back to Database 101 -- timestamps, versions, etc...
    If you use a DB trigger to initiate the resync request you might want to distinguish whether the update has come from the cache-store (in which case, you may choose to do nothing), or if the update was from the 'existing apps', etc...
    If you choose to inject the resync logic at the application code level - you have the usual sourcecode issues - can you modify the code, is all the DB code localized, what options do you have to link with Coherence functionality (DLL, external proc, webservice, etc), etc... Naturally though, if you have to make substantial changes to signal a resync....you might consider taking the extra step and change the code to write to the cache.

  • Has anyone experienced problems with Mackeeper? I did not complete downloading this software. Yet, occasionally when on the internet, I will have the MacKeeper multi-colored circle replace my pointer. How do you deal with this?

    Has anyone experienced problems with Mackeeper? I did not complete downloading this software. Yet, occasionally when on the internet, I will have the MacKeeper multi-colored circle replace my pointer. How do you deal with this?

    Welcome to Apple Support Communities
    Don't download MacKeeper. Users complain about this app and it damages OS X. Also, Mac OS X knows how to take care of itself, so you don't need any other cleaning application that may damage OS X. See > https://discussions.apple.com/docs/DOC-3691

Maybe you are looking for