I can access HSQLDB(OOo Base) by JDBC, but unable to update it, HELP!!!

here is a code to access HSQLDB (or OOo Base)
but unfortunately it can read the data only (and when i execute an update it fails to store them in next running...
here connection code...
public static void createConnection(){
        File defaultDataLocation = new File(getDatabasePath()+"/RamanInfo");
        defaultDataLocation.mkdir();
        defaultDataLocation = new File(getDatabasePath()+"/logs");
        defaultDataLocation.mkdir();
        try {
            Class.forName("org.hsqldb.jdbcDriver");
        }catch(Exception ex) {
            WriteToLog.writeToLog(ex.toString());
        ZipFile file = null; //For handling zip files
        ZipEntry ent = null;
        Enumeration en = null; //For the entries in the zip file
        BufferedOutputStream out = null; //For the output from the zip class
        InputStream in = null; //for reading buffers from the zip file
        int len; //General length counter for loops
        //Unzip zip file, via info from
        //http://www.devx.com/getHelpOn/10MinuteSolution/20447
        try{
            File db=new File(ConnectionManagement.getDatabasePath()+"/RamanInfo");
            if(!db.exists()){
                WriteToLog.writeToLog("Create a Database");
                //Open the zip file that holds the OO.Org Base file
                file = new ZipFile(ConnectionManagement.getDatabasePath()+"/RamanInfo.odb");
                //Get file entries from the zipfile and loop through all of them
                en = file.entries();
                while (en.hasMoreElements()) {
                    //Get the current element
                    ent = (ZipEntry)en.nextElement();
                    //If the file is in the database directory, extract it to our
                    //temp folder using the temp filename above as a prefix
                    if (ent.getName().startsWith("database/")) {
                        byte[] buffer = new byte[1024];
                        //Create an input stream file the file entry
                        in = file.getInputStream(ent);
                        //Create a output stream to write out the entry to, using the
                        //temp filename created above
                        out = new BufferedOutputStream(new FileOutputStream(ConnectionManagement.getDatabasePath()+"/RamanInfo/" + dbName + "." + ent.getName().substring(9)));
                        //Read the input file into the buffer, then write out to
                        //the output file
                        while((len = in.read(buffer)) >= 0){
                            out.write(buffer, 0, len);
                        //close both the input stream and the output stream
                        out.close();
                        in.close();
                //Close the zip file since the temp files have been created
                file.close();
            //Create our JDBC connection based on the temp filename used above
            try {
                ConnectionManagement.con = DriverManager.getConnection("jdbc:hsqldb:file:"+ConnectionManagement.getDatabasePath()+"/RamanInfo/" + dbName, "SA", "");
                ConnectionManagement.stmt=ConnectionManagement.con.createStatement();
            }catch (SQLException sqlex) {
                WriteToLog.writeToLog(sqlex.toString());
        }catch(IOException ioex){
            WriteToLog.writeToLog(ioex.toString());
    }and here an update code
public static int execQuery(String query){
        try{
            int result=ConnectionManagement.stmt.executeUpdate(query); // execute a query
            return result;
        }catch(SQLException sqlex){// an error is occured
            WriteToLog.writeToLog(sqlex.toString());
            return 0; //no updates occred
    }calling method is as follows:
execQuery("INSERT INTO \"branches\"(\"branch\") VALUES('Slemany')";it stores the data until exiting a program, when i exit a program
all stored data will be loss...
can any one help me to be able to store to the database????

OOOOOOOOoo
i fixed the error..
the error was about closing....
during exiting the connection...
you should run this statement (stmt.executeUpdate("shutdown");)
before closing it...
since the HSQLDB will not save updates in the dbName.data file, during running, but it keeps them inside the dbName.log file, but during shutting down it will save them inside dbName.data....
thank you very much...

Similar Messages

  • I have had a reinstall nightmare getting my loops back they are in the apple library, I can access them through the media browser but I only have a few available through the loop browser, how do I get them all back there again? please help

    I have had a reinstall nightmare getting my loops back they are in the apple library, I can access them through the media browser but I only have a few available through the loop browser, how do I get them all back there again? please help

    "Where do I find my hundreds of dollars of downloads I have done since 2005?"
    They will only be where you put them  If you are doing the very basics, then they will be on your computer and they will be in your backup copy of your computer.
    The itunes store is not global at all, never has been. You cannot redownload your content from another country.  You can only use the countrys itunes store for the country that you are physically located.

  • My iPod nano 6G stop working suddenly; After i reset it and even afetr put it in "stand by" mode by accessing deagnostic mode, it is still not working; Now i can access it sometimes (the main screen), but is not playing and is too slow. How can i fix it

    My iPod nano 6G stop working suddenly; After i reset it and even afetr put it in "stand by" mode by accessing deagnostic mode, it is still not working; Now i can access it sometimes (the main screen), but is not playing and is too slow. How can i fix it

    If you do not find a solution in the iPod nano (6th generation) - User Guide, suggest that you call AppleCare if still under warranty or take a trip to your local Apple Store or AASP.

  • How to I access my photos from icloud on my pc. I can access my calendar, notepad and reminders but not my photos

    How di I access my photos from ICLOUD on my PC? I can access my calendar, notepad and such but no photos

    Hi jbaker5d,
    If you are having an issue with photos not showing up in My Photo Stream on your Windows computer, I would suggest that you troubleshoot using the steps in this article - 
    Get help using My Photo Stream
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • I can play my video clips as events but unable to load them into project this just started

    I can play my video clips as events but unable to load them when I drag them to project.

    I am using a macbook pro not a mini

  • My Mac can access internet through my time capsule but can't find TC so I can set up time machine

    I have an iMac and a MacBook. 
    I can access the internet with both Macs using my time capsule.
    I can access the Time Capsule with my iMac and use it with Time Machine for backups.
    I can't use my Time Capsule for Time Machine backup since my MacBook can't identify Time Capsule as a drive for this purpose.
    Any suggestions on what I should do to have my MacBook recognize my Time Capsule for Time Machine use?
    thanks

    So the TC does not show up as an available drive at all in the MBP.. what weird things happen??
    Use finder, go, go to server, and use AFP://ipoftimecapsule.  (that being the IP address of the Time Capsule)
    In router mode and at default it is 10.0.1.1 but check.
    If it doesn't work tell us the IP of the TC .. and how it is setup, router or bridge.
    IP of the mac that works, and IP of the MBP that doesn't work.
    I am assuming you have done the more basic stuff.
    Pondini might help you.
    http://pondini.org/TM/Time_Capsule.html

  • I can access one pc on my network but not the other, "Alias" issue?

    I have 2 pc's other than my mac running on my network, I can access one with no problem, the other for some reason I can not. When I try to open the server icon it states "The alias could not be opened, because the original item could not be found"
    I have restarted my mac it obviously is detecting the pc is on the network, the pc has a shared folder. But everything i try to access it, it comes up with this error after asking me for my user name and password.
    Any help?
    Thanks

    Instead of using the alias.
    Finder > Go > Connect to Server
    smb://IP Address of PC
    Sharing files between an XP PC and a Mac running OS 10.4.x
    http://tech.ifelix.net/3020.html
    iFelix

  • I have set up an administrator account and three separate accounts for my kids. I have loaded microsoft office 2011. i can access it from the administrator account but not my kids account. how can I give them access?

    I have set up an administrator account and loaded microsoft office mac 2011. i have now added three kids accounts but can't seem to enable them to access the office mac software...... help please.

    Where did you install Office?
    If you installed it to the Applications folder in the admin account that ie reason why only you can access it.
    If you want everyone to be able to access it then you should install it in the Applications folder at root level.
    Allan

  • HELP! I I can access my Z10 as a Drive but BB Link cannot see it!

    Hi!
    As you can see in the image below, I can access the Z10's storage as a drive, I can ping the device, but the stupid Link says "Not connected"!! Why?!!!
    I have reinstalled BB Link many times, with and without Windows 7 Compatibility modes (XP Compatibility) and have placed the device in Airplane mode... Have tried it on a Win7 32 bit PC and a 64 bit laptop..
    What to do??????

    Hi jlbenc,
    Here is a KB article that might help you resolve your connection issue with BlackBerry Link.
    "BlackBerry 10 smartphone is unable to connect to BlackBerry Link via USB" KB33832
    Let me know if that helps.
    -FS
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • I can access my FaceTime in my iPad but i cannot access it in my macbook pro.

    Hi Guys,
    I am a new mac user and i cannot access my facetime in my macbook pro. my apple accoung is ok because i can access face in my ipad.

    Hi Mr.Seseng,
    Thanks for visiting Apple Support Communities.
    If you can use FaceTime on your iPad but not your Mac, the troubleshooting steps in this article can help:
    FaceTime for Mac: Troubleshooting FaceTime
    http://support.apple.com/kb/ts4185
    All the best,
    Jeremy

  • I can't find ITunes Radio on my phone after the update. Help?

    I updated my iPhone to ios7 and wanted to use iTunes radio but I can't seem to find it anywhere 

    It is not in music app i searched all the possible location but unable to locate it in music app.

  • Suddenly, my 1st gen can't access iTunes store.  It sits on "Accessing iTunes Store", with a spinning wheel for days.  I can access the store from my iMac, but not the Apple TV.  Everything is up to date.  What's the deal?

    I can't figure out why my 1st gen appletv cannot access the itunes store.  All newer movies are coming up to view and I can watch previews, but when I go to rent, it stays on the spinning wheel with the Accessing iTunes Store forever.  I've left it going for at least 4 or 5 days.  I can rent from my iMac, but all I have is the headphone, analog, 2-channel audio feed and not the true digital surround.  It sounded much better from the appletv.  HELP!

    Read a bunch of posts from 2008 and 2010.  The only step I found that I hadn't tried was the ol' plug pull.  After that, I got the first movie I tried renting.  ???  At least it works now.

  • I can access the internet on my iPad but I can't access Facebook or my own email

    When I put in my username and password, the iPad just will not process to give access.  I went into "Settings" and turned Block Pop-ups to OFF but I still can't get into Facebook and my eircom email.  What do I need to do? 

    if it's a facebook app try accessing facebook in the browser and the other way around if it's in the browser you have problems
    about mail then most likely the config is set wrong verify each setting with your mail provider's setting list

  • Suddenly, I can access my mailbox on AOL Mail but I cannot read anything when I try to open the individual mail. Get blank "page," even though something clearly is there (when accessed vis Explorer or Safari). What's wrong and how do I fix it?

    This is on my desktop PC running Windows XP. Have used Firefox successfully for a couple of years. This problem was first noticed on 1/18/2012.
    Logging off and logging back into AOL does not fix it. Closing and re-opening Firefox does not fix it. Shutting down and rebooting the PC does not fix it.
    Thanks for any help/explanations.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • Facebook does not support latest upgrade to Firefox. Can access Facebook throuogh IE* (ugh!) but not Firefox

    Since upgrading to the l;atest firefox am unable to access facebook. they say they do not support your latest plugin. WHEN are you going to fix so I don't have to use IE8?

    There is nothing to fix in Firefox, if a plugin is not working you need to contact the makers of the plugin.

Maybe you are looking for

  • Please make this a good experiance for my first post on any board.  READ ME

    Hi all. Well first off, let me start by saying that my whole life I've owned PC's. And I'm not hacker Elliet. But I've gotten to know them pretty well. All the way from Windows 3.1 that came out a long time ago (more than 10 years ago) So after a whi

  • New Key Figure Requrinment

    hellow gurus i'm workin on BW 3.5 now in a report i need a new info object which is equal to Warranty Quanity / Sales Qty.. But the requirnment is Warranty qty = Sum of all Warranty Quantities of last 12 month but Sales Qty = Sum of all Sales Quantit

  • Installing older version of iTunes

    I am trying to install an older version of Itunes and am getting the following error: The file iTunes Library.itl cannot be read because it was created by a newer version of iTunes. I have tried renaming the file, deleted the folder iTunes in my docu

  • Form name and email being autofilled. cant delete

    I am using latest firefox 4 /vista ...see below when I go to certain sites, the logon name and email that i used previously a loooong time ago on another site appear automatically in the name and email field (of the comment section) . I have never vi

  • Designer 7.0 form not working correctly in Acrobat 6.0 standard

    Hi, I've created a fill and email submit form in Designer 7.0 but saved it as a static form compatible with V6.0 products. The form fills, validates, submits correctly and the returned XDP file views correctly when V7.0 products or Reader V6.0 is use