3 Replies Latest reply on Oct 6, 2008 11:35 AM by peterj

    Problem Regarding hsqldb-ds.xml

      Hi All,

      I have a problem related to hsqldb-ds.xml

      when i uncomment below mention tag from hsqldb-ds.xml file, which says
      For totally in-memory db, not saved when jboss stops.
      does it means that data would not remain in permanent memory?
      like if restart server data will be lost?


      For totally in-memory db, not saved when jboss stops.
       The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
       <connection-url>jdbc:hsqldb:.</connection-url>
      

      and i comment this tag too

      <!-- For in-process persistent db, saved when jboss stops.
       The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
      
       <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
       -->
      



      if it is, it does nothing data remains in memory when i restart server :)
      and i get problem while fatching the data using some application code.

      Any clue about it

      Regards,
      Sachin Parnami

        • 1. Re: Problem Regarding hsqldb-ds.xml
          peterj

          The hsqldb-ds.xml file contains three connection-url entries, two of which must always be commented out, and one of which must always be uncommented. The one that is not commented out determines the behavior.

          In all cases, all of the database data is kept in memory while running.

          The default one (the third one, "in-process persistent db") causes Hypersonic to write the database contents to the file server/xxx/data/hypersonic/localDB.script when the app server halts. This script is used when the app server starts again to initialize the database.

          If you use the second one ("not saved when jboss stops"), Hypersonic will not write the localDB.script file. So every time the app server starts you get a clean, empty database.

          The first one ("For server mode db") start Hypersonic in a separate process, and all database access goes over TCP. Other than that, I behaves much like the third option - the localDB.script file is created when Hypersonic is stopped.

          • 2. Re: Problem Regarding hsqldb-ds.xml

            Hi Peter,

            Thanks for your reply.

            But Problem here is that when i comment the below mention code even thought data persist in the memory when i restart the server.

            <!-- For in-process persistent db, saved when jboss stops.
             The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
            
             <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
             -->
            
            
            


            And i am also uncommenting the code mentioned below :)
            For totally in-memory db, not saved when jboss stops.
             The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
             <connection-url>jdbc:hsqldb:.</connection-url>
            
            


            As per your detailed description it should not be persisted right?
            but it does :(

            Regards,
            Sachin Parnami

            • 3. Re: Problem Regarding hsqldb-ds.xml
              peterj

              If you want to use the "totally in-memory db", remove the server/xxx/data directory before bringing up the app server. If you do not do this then the old database will be reloaded. Thus, the "totally in-memory db" option applies during the time the app server is halted, not to when it is started up.

              I did this, and saw that there was still a server/xxx/data/hypersonic/localDB.script file created, but the file was missing the DDL statements that create tables and the INSERT statements that reload data. This fact that the file still appears tells me that Hypersonic always loads the file, regardless of the url-connection setting. Hence my suggestion to remove the server/xxx/data directory.

              By the way, "data persist in the memory" is an oxymoron - persisting data means moving/copying data out of memory and to a permanent storage device such as a disk drive.