Archive | hsqldb RSS feed for this section

shutdown-adn-drop-hsqldb-in-memory

31 Jan

https://coderwall.com/p/xqbmma

http://hsqldb.org/doc/guide/ch01.html

http://stackoverflow.com/questions/2951013/how-do-you-delete-the-default-database-schema-in-hsqldb

http://jena.sourceforge.net/DB/hsql-howto.html

http://hsqldb.org/doc/guide/guide.html

http://vageeshhoskere.wordpress.com/2011/06/16/unit-test-with-junit-for-hibernate-using-hsqldb-in-memory/

http://stackoverflow.com/questions/4990410/how-can-i-wipe-data-from-my-hsqldb-after-every-test
 

guide sql

http://www.hsqldb.org/doc/1.8/guide/ch09.html
 
from the guide :
 http://hsqldb.org/doc/guide/guide.html
 
 

Closing the Database

All databases running in different modes can be closed with the SHUTDOWN command, issued as an SQL statement.

When SHUTDOWN is issued, all active transactions are rolled back. The catalog files are then saved in a form that can be opened quickly the next time the catalog is opened.

A special form of closing the database is via the SHUTDOWN COMPACT command. This command rewrites the .data file that contains the information stored in CACHED tables and compacts it to its minimum size. This command should be issued periodically, especially when lots of inserts, updates or deletes have been performed on the cached tables. Changes to the structure of the database, such as dropping or modifying populated CACHED tables or indexes also create large amounts of unused file space that can be reclaimed using this command.

Databases are not closed when the last connection to the database is explicitly closed via JDBC. A connection property, shutdown=true, can be specified on the first connection to the database (the connection that opens the database) to force a shutdown when the last connection closes.

Example 1.4. specifying a connection property to shutdown the database when the last connection is closed

 Connection c = DriverManager.getConnection(
         "jdbc:hsqldb:file:/opt/db/testdb;shutdown=true", "SA", "");


This feature is useful for running tests, where it may not be practical to shutdown the database after each test. But it is not recommended for application programs.

Creating a New Database

When a server instance is started, or when a connection is made to an in-process database, a new, empty database is created if no database exists at the given path.

With HyperSQL 2.0 the username and password that are specified for the connection are used for the new database. Both the username and password are case-sensitive. (The exception is the default SA user, which is not case-sensitive). If no username or password is specified, the default SA user and an empty password are used.

This feature has a side effect that can confuse new users. If a mistake is made in specifying the path for connecting to an existing database, a connection is nevertheless established to a new database. For troubleshooting purposes, you can specify a connection property ifexists=true to allow connection to an existing database only and avoid creating a new database. In this case, if the database does not exist, the getConnection() method will throw an exception.

Example 1.5. specifying a connection property to disallow creating a new database

 Connection c = DriverManager.getConnection(
         "jdbc:hsqldb:file:/opt/db/testdb;ifexists=true", "SA", "");

A database has many optional properties, described in the System Management chapter. You can specify most of these properties on the URL or in the connection properties for the first connection that creates the database. See the Properties chapter.

 
………………………………….

http://johannesbrodwall.com/2004/11/08/using-hsqldb-for-in-memory-dao-tests/

http://stackoverflow.com/questions/16694067/hsqldb-inmemory-mode-doesnt-delete-files-on-shutdown

…………………………………

FAQ
http://hsqldb.sourceforge.net/web/hsqlFAQ.html
 
 
……………………..
 
hsql properties
 
view the connectionnURL
 
http://hsqldb.org/doc/guide/dbproperties-chapt.html
 
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
con hsqldb
http://eskatos.wordpress.com/2007/10/15/unit-test-jpa-entities-with-in-memory-database/
con derby
http://eskatos.wordpress.com/2009/10/26/unit-test-jpa-entities-with-in-memory-derby/
 
 
http://codeblow.com/questions/easy-and-reliable-in-memory-database-for-fast-java-integration-tests-with/
 
https://code.google.com/p/jpa-unit/wiki/howitworks
 
Advertisements