Why does not the data get saved into the Database

Please check if there is any thing wrong with my code here. Why cant i save the data in to my database. when i used the same things in other places it works.
guys i have copied a portion of the code here. right now i have commented few areas to not give me any errors on the whole program
Please check why cant i save the data into the database.
i have created a seperate class for database connection Utilities
void saveData()
               //Utilities ut = new Utilities();
               //connection = ut.getConnection();
               //ResultSet resultSet;
          // JourneyID = ut.getResults(qryJourneyID);
               strJourneyID = txtJourneyID.getText();
               System.out.println("++++++++++++++++++++++++"+strJourneyID);
               strVehicleID = (String)comboVehicleID.getSelectedItem();
               System.out.println("++++++++++++++++++++++++"+strVehicleID);
               strDriverID = (String)comboDvrID.getSelectedItem();
               System.out.println("++++++++++++++++++++++++"+strDriverID);
               strStartDateTime = txtDateTime.getText();
               System.out.println("++++++++++++++++++++++++"+strStartDateTime);
               int a = JOptionPane.showConfirmDialog (null, "Are u sure you want to save the changes?", "WARNING!", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (a == 0)
                         if(NEW)// new is a boolean value
                              //ADDING NEW DATA STATMENT
                              System.out.println("INSERTING NEW ROW IN THE TABLE...");
                              try
                                   String insert ="INSERT INTO Job VALUES (" + "'" + strJourneyID + "'"+
                                   ", '"+ strVehicleID +     "',"
                                   +"'"+ strDriverID +"',"
                                   + "'"+ strStartDateTime +"')";
                                   System.out.println("STATEMENT IS " + insert);
//                                   InsertStmt = connection.createStatement();
//                                   InsertStmt.executeUpdate(insert);
                                   JOptionPane.showMessageDialog(null, "You data has been successfully saved.","TIS: Operation completed", JOptionPane.INFORMATION_MESSAGE);
                              catch (Exception e)
                                   e.printStackTrace();
                                   JOptionPane.showMessageDialog(null, "Problem encountered while adding new data");
                         else
                              JOptionPane.showMessageDialog(null, "it is supposed to save data");
                              /*try
                                   String ChangeRecord = "UPDATE Job SET " +
                                   "JourneyID = '" + strJourneyID+ "'"+
                                   "VehicleID = '" + strVehicleID+"',"+
                                   "DriverID = '"+strDriverID+"'," +
                                   "StartDateTime='" + strStartDateTime+ "'";//syntax error???
                                   System.out.println(""+ ChangeRecord);
                                   UpdateStmt = connection.createStatement();//just added
                                   UpdateStmt.executeUpdate(ChangeRecord);
                                   JOptionPane.showMessageDialog(null, "You data has been successfully saved.","TIS: Operation completed", JOptionPane.INFORMATION_MESSAGE);
                              catch (Exception change_exception)
                                   change_exception.printStackTrace();
                                   JOptionPane.showMessageDialog (null, "Problem encountered while updating","TIS: Problem encountered",JOptionPane.ERROR_MESSAGE);
                    else
                         JOptionPane.showMessageDialog(null, "You chose to cancel the operation","Operation cancelled", JOptionPane.INFORMATION_MESSAGE);
                    }

Yes you have commented all the code that update the
database so how can it update the database.
By the way for inserting dont use Statement use
PrepairedStatement
by the way next time please post codes in code tagsMan i have commented it becaues it if i dont comment it givens me errors. like cannot find variable and i dont understand how to use the code button. whereever i click the code button it displays the  at the end of the code! what to do?
connection = ut.getConnection();
ResultSet resultSet;
UpdateStmt = connection.createStatement();
UpdateStmt = connection.createStatement();
UpdateStmt.executeUpdate(ChangeRecord);
please check it once again
void saveData()
               Utilities ut = new Utilities();
               connection = ut.getConnection();
               ResultSet resultSet;
          // JourneyID = ut.getResults(qryJourneyID);
               strJourneyID = txtJourneyID.getText();
               System.out.println("++++++++++++++++++++++++"+strJourneyID);
               strVehicleID = (String)comboVehicleID.getSelectedItem();
               System.out.println("++++++++++++++++++++++++"+strVehicleID);
               strDriverID = (String)comboDvrID.getSelectedItem();
               System.out.println("++++++++++++++++++++++++"+strDriverID);
               strStartDateTime = txtDateTime.getText();
               System.out.println("++++++++++++++++++++++++"+strStartDateTime);
int a = JOptionPane.showConfirmDialog (null, "Are u sure you want to save the changes?", "WARNING!", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (a == 0)
                         if(NEW)
                              //ADDING NEW DATA STATMENT
                              System.out.println("INSERTING NEW ROW IN THE TABLE...");
                              try
                                   String insert ="INSERT INTO Job VALUES (" + "'" + strJourneyID + "'"+
                                   ", '"+ strVehicleID +     "',"
                                   +"'"+ strDriverID +"',"
                                   + "'"+ strStartDateTime +"')";
                                   System.out.println("STATEMENT IS " + insert);
//                                   InsertStmt = connection.createStatement();
//                                   InsertStmt.executeUpdate(insert);
                                   JOptionPane.showMessageDialog(null, "You data has been successfully saved.","TIS: Operation completed", JOptionPane.INFORMATION_MESSAGE);
                              catch (Exception e)
                                   e.printStackTrace();
                                   JOptionPane.showMessageDialog(null, "Problem encountered while adding new data");
                         else
                              JOptionPane.showMessageDialog(null, "it is supposed to save data");
                              try
                                   String ChangeRecord = "UPDATE Job SET " +
                                   "JourneyID = '" + strJourneyID+ "'"+
                                   "VehicleID = '" + strVehicleID+"',"+
                                   "DriverID = '"+strDriverID+"'," +
                                   "StartDateTime='" + strStartDateTime+ "'";//syntax error???
                                   System.out.println(""+ ChangeRecord);
                                   UpdateStmt = connection.createStatement();//just added
                                   UpdateStmt.executeUpdate(ChangeRecord);
                                   JOptionPane.showMessageDialog(null, "You data has been successfully saved.","TIS: Operation completed", JOptionPane.INFORMATION_MESSAGE);
                              catch (Exception change_exception)
                                   change_exception.printStackTrace();
                                   JOptionPane.showMessageDialog (null, "Problem encountered while updating","TIS: Problem encountered",JOptionPane.ERROR_MESSAGE);
                    else
                         JOptionPane.showMessageDialog(null, "You chose to cancel the operation","Operation cancelled", JOptionPane.INFORMATION_MESSAGE);
                    }

Similar Messages

  • Where does the data get saved from (notepad) or Notes on Windows Mobile 5?

    Where does the data get saved from (notepad) or Notes on Windows Mobile 5?
    (ON the Phone)  Sticky note like program WM5
    I ask because I synced my Blackjack 1 to my pc after about a year and MANY notes later, All the notes from the PC remained but ALL new notes on phone (a years worth) were deleted from the phone.
    I would like to attempt a data recovery on my mobile device- that was an insane endeavor but i got it to work now i just need to know what to look for (what type of files to recover) and or where to recover from?
    I did make the phone a drive already and have data recovery software that can pull deleted files from the phone in fat or raw data format.
    Thanks.

    Hi,
    I think this is not the best forum for your question. This forum is for Microsoft Exchange Server's mobile connectivity issues.
    Regards,
    Zoltán
    http://www.clamagent.org - Free Antivirus for Exchange
    http://www.it-pro.hu
    http://emaildetektiv.hu

  • I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

  • 0EC_PCA_3 does not return data in RSA3 if the target system is entered

    Hello all,
    Datasource 0EC_PCA_3 is not transferring data to the BW 7.0 system. In the ECC 6.0 system datasource 0EC_PCA_3 does not return data in RSA3 if the target system (BWDCLNT100) is entered in the selection fields. When omitting the target system all expected data is returned.
    Datasource 0EC_PCA_1 works fine for the same target system.
    There is one thread dealing with the same problem but the person does not provide the solution he found.
    Does anyone know what the issue is?
    Regards and thanks,
    József.

    The problem was solved by removing the datasource in both BW and R/3 and activating everything from scratch again. We didn't find out what was the cause of the problem, but at least it is working now.

  • Why does my form data gets cleared out when clicking on the back button.

    Can someone explain why does my form selections get cleared out when clicking on the back button.
    I have a JSP page that displays a form with some selections and text boxes. I populate the page and submit the request. The action on the submit call another jsp page, which processes the data and displays the results via a <jsp:include> statement which calls the results page. When clicking on the back button from the results page, it returns me to the form page, but the selections are cleared out.
    1. Is there something in my calling of the pages that causes this behavior and can I prevent it?
    I notice that the behavior is different when using the IE 6.0 version Netscape 7.1. IE clears the page Netscape 7.1 retains the settings.
    If I cannot prevent this behavior does that mean I will have to save the state of the form data. And if I have to save the form data, what would be the easiest method of doing this. I'm a beginner to JSP and Java, but have some ASP experience. I don't understand why the back button in a JSP request clears the form data but a regular HTML page does not can someone explain?
    THANKS.

    the browser doesn't have to remember what you submitted and fill that back in.
    you can't prevent it unless you can ensure a new request to the server in which you can fill the default values in there.

  • HT1430 where does the backup get saved on the windows computer?

    whenever m tryin to backup my phone it starts and after consuming the space on the hard drive of computer it stops after the msg saying bakup could nt b saved on the computer.. so my question is where does the backup get saved on d computer  n how to access it n hw to clear the old backup history n free the space on the computer? help plz...

    WHERE ARE BACKUPS LOCATED
    ITunes stores one active backup and each time a backup is created the old backup is overwritten.  Icloud saves the last three backups.  You cannot view the backups unless you have special software to read it.  If you want to know where the backups are located on your computer then read this article
    http://support.apple.com/kb/HT4946

  • Why does URLStream complete event get dispatched when the file is not finished loading?

    I'm writing an AIR kiosk app that every night connects to a WordPress server, gets a JSON file with paths to all the content, and then downloads that content and saves it to the kiosk hard drive. 
    There's several hundred files (jpg, png, f4v, xml) and most of them download/save with no problems.  However, there are two f4v files that never get downloaded completely.  The complete event does get dispatched, but if I compare the bytesTotal (from the progress event) vs bytesAvailable (from the complete event) they don't match up; bytesTotal is larger.  The bytesTotal (from the progress event) matches the bytes on the server. 
    The bytesLoaded in the progress event never increases to the point that it matches the bytesTotal so I can't rely on the progress event either.  This seems to happen on the same two videos every time. The videos are not very large, one is 13MB and the other is 46MB.  I have larger videos that download without any problems.  
    [edit] After rebooting the compter, the two videos that were failing now download correctly, and now it's a 300kb png file that is not downloading completely.  I'm only getting 312889 of 314349 bytes.
    If I paste the url into Firefox it downloads correctly, so it appears to be a problem with Flash/AIR.
    [edit] I just wrote a quick C# app to download the file and it works as expected, so it's definitely a problem with Flash/AIR. 
    Here's the code I'm using:
    package  {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import flash.net.URLRequest;
        import flash.net.URLStream;
        [SWF(backgroundColor="#000000", frameRate="24", width="640", height="480")]
        public class Test extends Sprite {
            private var fileSize:Number;
            private var stream : URLStream;
            private var url:String = "http://192.168.150.219/wordpress2/wp-content/uploads/2012/12/John-Butler-clip1.f4v";
            public function Test() {
                if (stage)
                    init();
                else
                    this.addEventListener(Event.ADDED_TO_STAGE, init);
            private function init(e:Event=null):void {
                this.removeEventListener(Event.ADDED_TO_STAGE, init);
                stream = new URLStream();
                stream.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
                stream.addEventListener(Event.COMPLETE, onLoadComplete);
                stream.load(new URLRequest(url));
            private function onLoadProgress(event:ProgressEvent):void {
                fileSize = event.bytesTotal;
                var percent:Number = event.bytesLoaded / event.bytesTotal * 100;
                trace(percent + "%");
            private function onLoadComplete(event:Event):void {
                trace("loaded", stream.bytesAvailable, "of", fileSize);
                // outputs "loaded 13182905 of 13184365"
                // so why is it "complete" when it isn't finished downloading?

    Thanks for your quick reply !
    I am relatively new to programming so please bear with me on this as I still haven't managed to grasp some of those things that "make perfect sense". If I am setting mouseEnabled to false doesn't that mean that the object no longer gets MouseEvents ?
    If I have understood you correctly then once the mouseEnabled is set to false the btn object is removed from the objects recognizable by the mouse - hence dispatching a mouseout event (and I am guessing here) from the mouse?
    I still don't get it though, if the listeners are set to the object and the object is no longer accessible to the mouse why is the event still being dispatched ?
    I get it that the making of the object unavailable to the mouse causes the "removing" (deactivating) of the object from under the mouse,
      step 1. deactivate object, and  step 2. (as a result of step 1) register the removal of the object.
    but why is the mouse still listening after step 1?
    Even if the action is that of "out" (as in the object is no longer under the mouse) it still is an action isn't it ? so haven't we turned off the listening for actions ?
    I promise I am not trying to drive you crazy here, this is just one of those things that I really want to get to the root of !
    Thanks,

  • Why does not "Copy data" menu item of Colormap chart work?

    I need to get image of colormap chart (Sound and Vibration Toolkit v4.0) when program is running or stopped. It is very easy to get image in the clipboard by using "Copy data" popup menu item, but there is a problem.
    There is "SVXMPL_Getting Started with SVT (Simulated).vi" example where colormap chart is used. In this example it is possible to get image of colormap chart (axes, grids and data) by simply clicking "Copy data" popup menu item.
    Colormap chart in program puts into clipboard only image with axes and grids! I have compared colormap charts settings in both cases and have not found any difference related to "Copy data" functionality. Any ideas how to fix it?
    Running Labview v8.0 and Sound and Vibration Toolkit v4.0 on Windows 2000/SP4.
    In the attach there are chart and clipboard images.
    Attachments:
    colomap-chart-copy-data-pro.png ‏23 KB

    For sure I am using intersity chart in my program (look at the attached image), but "Copy data" copies blank chart image.
    I have done very simple test with modified intersity chart used in SVXMPL_Getting Started with SVT (Simulated).vi example:
    1) Modified intersity chart was copied to my program - "Copy data" copies blank chart image.
    2) Copy of modified intersity chart was copied back to the SVXMPL_Getting Started with SVT (Simulated).vi example. Two charts were connected in parallel with the same settings and property nodes. In original chart "Copy data" copies right chart image, in twice copied chart "Copy data" copies blank chart image.
    So I am a little bit confused with such chart behaviour. Does it mean that some specific chart setting affects "Copy data" feature? And this setting is not copied by copy'n'paste?Message Edited by rsa1024 on 01-31-2007 03:51 PM
    Attachments:
    colormaps cmp.png ‏24 KB

  • Why does not my battery get charged?

    I just plugged in imy charger after my laptop said that it was on reserve battery. But now it is not getting charged. The magsafe adapter does show the green light and on the laptop it shows that battery is not charging. What should I do? And why is this happening?

    In addition to Eric Ross' suggestions, try another power adapter if available.  Check the connections where it is inserted in the MBP.  See if the pins, which are spring loaded in the power adapter, are not stuck.
    Also go to check the status of the battery in System Profiler>Hardware>Power>Battery Information.  Ex. from mine:
    Ciao.

  • My iPod does not work properly when plugged into the computer. How to fix?

    I have a 4th generation 40 gigabyte iPod, non-color.
    Today, I plugged it into my computer to update my playlists.
    My iTunes and Windows were lagged down. Eventually, when things caught up, my iTunes didn't show my iPod as being connected. I looked in My Computer, and it didn't say iPod -- it said "Removable Disk". I couldn't disconnect my iPod via Windows, even using the Safely Remove Hardware didn't work.
    After looking around here and trying things like Disk Mode and Resetting the iPod, nothing worked. I can't get the iPod to work with the iPod Updater so I can try restoring it.
    I dunno really what to do. If it's a hardware problem, then I'm not going to bother to get it repaired, since the music that's currently on it plays perfectly fine still.
    I just dunno what else to try.

    you basically are stuck. apple won't do crap for you. i went to the apple store today because my second ipod crashed (the first one they replaced) and they won't do anything for me and told me i had to buy a new one (2 in 1 1/2 years is what happened) so they wanted me to buy a third one when their product obviously *****. and the manager even basically admitted that the ipod that they claim is durable and relible isn't. that people go through 3-4 a year. the supposed "apple genius" told me to send it out to a third party repair. he wouldn't even look at it and lectured me for not getting the extended warranty. if you look at the website below and read you'll find that a lot of people got screwed over like me with the extended warranty;
    http://www.consumeraffairs.com/computers/apple_ipod.html
    put it this way i won't go back to that apple store again or purchase another ipod. ill keep my piece of none working crap

  • It does not allow me go in a webpage that i could previously use, it just does not allow me to log into the webpage

    i previously using firefox could access this webpage, but it logged me out and from then onwards i could no longer logg into the webpage as it keeps denying my information to log in, it is not the webpage as i can log in using internet explorer so i assume that the problem lies with firefox and the webpage.

    Numbers documents from iOS need Numbers 3.2 on a Mac to open. And Numbers 3.2 requires Mavericks. If you are using Mavericks you can get Numbers 3.2 from the Mac App Store. It will be free IF you have Numbers 2 (iWork '09) installed. Otherwise you must buy it.
    Your other option is to send the Numbers file as an Excel file via e-mail to yourself to open with an earlier version of Numbers.

  • How to fix an iPod touch that does not charge but gets hot in the lower back area?

    I have a 3rd generation iPod touch 32gb and it will not turn off, nor will it charge. Plugging in to my computer, iTunes does not even detected. Even if I leave it to charge, it does not detect it. The odd thing is that it get really hot in the lower back area of the iPod. It is hot to the touch, as though it were 80 degrees+. Anyway for me to fix this?
    The iPod is way out of warrenty, so I wonder if a Genius bar appointment will even help me. But I will give them a try.

    Replace the battery.  If that does not work, then system board is toasted...

  • Why does my iMessage always get stuck in the sending mode?

    Whenever I try to send an iMessage it gets stuck in the sending mode and just sits there and in hardly receive my messages because of it, please make this stop. My parents both have iPhones and theirs don't do it.

    The sending and receiving of iMessages is dependent on an active data connection. If you are sending, the recipient has to have an active connection as well, and this can result in the behavior that you are describing. Try double tapping on the home button and finding the Messages app in the multi-tasking tray. Touch and hold the icon until it starts to wiggle. Tap on the minus sign to close it. Do a reset on the phone. Hold the sleep/wake and home buttons together until you see the Apple logo and then release. After the phone restarts, open the Messages app and try messaging again. You can try to message with one of your parents right there with you and see how that works.

  • Why does my iphone 5 get hot on the sides and back ???

    Hi ,
    I got a iphone 5 on contract with 3 in august /september time my phones hardly been used its used rarely by my self and just gets hot on the sides and back ive reset my phone to see if any difference and there is none
    how can i fix this???
    thanks
    Gazza

    I would contact applecare about this issue. a hot phone is not normal , a warm phone is.
    but if you contact applecare that way you have a record of the issue incase it gets worse in the future.

  • ITunes does not start. Get a message "The procedure entry point CMBlockBufferCopyDateBytes could not be located in the dynamic link library CoreMedia.dll.

    What do I do to correct this situation?

    Entry point errors can often be fixed by deleting the offending dll, then repairing the component it is part of. CoreMedia.dll is part of Apple Application Support.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If the advice above doesn't resolve things you could try this alternate version:
    iTunes 12.1.0.71 for Windows (64-bit - for older video cards) - itunes64setup.exe (2015-01-28)
    which is a 64-bit installer for the 32-bit version of the core application, similar to previous 64-bit releases.
    Or roll back to the previous build:
    iTunes 12.0.1.26 for Windows (32-bit) - iTunesSetup.exe (2014-10-16)
    iTunes 12.0.1.26 for Windows (64-bit) - iTunes64Setup.exe (2014-10-16)
    tt2

Maybe you are looking for

  • Trouble First Time Start after Installing Oracle10g on Windows Xp

    I have installed Oracle10g release2 on windows xp OS. My installation details are as under. Oracle_Base : C:\oracle\product\10.2.0\home2 Oracle_Home / Global Database name : dadc.testdata Oracle_SID : dadc I am trying to connect and start sqlplus wit

  • How to check if nativemenu already exists?

    In my simple example below, everytime you click on the link to reload the page, a new nativemenu is created along with the one that was already there... Click the HOME-INDEX link multiple times and you will see multiple copies of same menu pop up alo

  • Passing Parameters In OEM

    Oracle RDBMS 9.2.0.3 IA 9.2.0.3 OMS 9.2.0.3 OEM 9.2.0.1 In OEM I am creating a job to execute a PL/SQL procedure which needs to take two parameters. If I were to run the PL/SQL proc from a SQL Plus prompt I would type: exec REPORTS('September', '2003

  • Got charged $80 for a game I never bought

    I got charged $80 for one of those games with in-app purchases. I never bought this game (I'm the one who has access to my laptop and iPod), so it wasn't a mistake from someone else. I don't even have that game installed on the iPod or in iTunes. The

  • Null Under Query Name in BI Statistic

    Dear all Why in BI Statistic there are lots of records with empty query name in the InfoCube BW statistic OLAP- 0BWTC_C02 ? Regards Desmond