hsqldb

Embedded HSQLDB persist data to a file

故事扮演 提交于 2019-11-30 13:29:20
I am creating a spring based web application that uses embedded hsqldb. My spring config is pretty simple: <jdbc:embedded-database id="dataSource" type="HSQL" > <jdbc:script location="classpath:scripts/create-table-if-not-exists" /> </jdbc:embedded-database> But with this config all data is stored in memory. Here is the data source url that is created jdbc:hsqldb:mem:dataSource I need to persist data to a file. So that I can use it again after server restart. This solution worked for me <bean class="org.apache.commons.dbcp2.BasicDataSource" id="dataSource"> <property name="driverClassName"

Hibernate @generatedvalue for HSQLDB

瘦欲@ 提交于 2019-11-30 13:10:32
I have the following definition for an id field in an entity that is mapped to a table in HSQLDB. ... @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "ID") private Integer id; ... But this does not seem to generate the an unique id; instead an attempt is made to insert null into the column which results in failure. If, I manually create a sequence and generation strategy to use that sequence then the data is persisted as expected. Doesn't a generation strategy of auto imply that the provider (hibernate in this case) will automatically choose the correct approach and do all the

Difference between In memory databases and disk memory database

匆匆过客 提交于 2019-11-30 12:04:39
问题 Recently i heard about the concept of In memory database. In any type of database we are finally storing the data in the computer,from there our program will get the data .How in memory database operations are fast when compared to the others. Will the in memory database load all the data from the database into memory(RAM). Thanks in advance.... 回答1: An in-memory database (IMDB; also main memory database system or MMDB or memory resident database) is a database management system that

How to do “select current_timestamp” in hsqldb?

笑着哭i 提交于 2019-11-30 08:23:54
Oracle: select systimestamp from dual MySQL: select current_timestamp SQL Server: select current_timestamp PostgreSQL: select current_timestamp The question is, how can I get the current timestamp in HSQLDB ? I use version 1.8.0.10 You can write select current_timestamp from tablename where tablename is a real table in your database. The result of the query is only the current timestamp. In a select I use SELECT CURRENT_DATE AS today, CURRENT_TIME AS now FROM (VALUES(0)) pilcrow @alexdown's answer is quite right -- under 1.8 you need a one-row relation to do this, like Oracle's DUAL or the

logging SQL expressions from within HSQLDB

可紊 提交于 2019-11-30 04:56:31
问题 I use HSQLDB in my application. Now i need to log every single sql statement which was executed. I do not want to handle SQL-logging myself. Is there a standart way of doing this from within HSQLDB? 回答1: HSQLDB 2.2.x supports SQL logging. Suppose your database is named test and you connect using the JDBC URL jdbc:hsqldb:file:test test.log is the data change log used internally by HSQLDB. It does not contain SELECT statements. It is created and deleted by HSQLDB. This is not what you are

How to check if a database exists in Hsqldb/Derby?

廉价感情. 提交于 2019-11-30 04:48:10
问题 I am looking for information how to check if a database exists -- from Java code -- in hsqldb and in Apache derby. In Mysql it is quite easy, because I can query a system table -- INFORMATION_SCHEMA.SCHEMATA -- but these two databases seem not to have such a table. What is an alternative to mysql query: SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = <DATABASE NAME> to find if a database exists in hsqldb and apache derby? 回答1: Checking if a Database exists One solution

Startup script to create a schema in HSQLDB

半腔热情 提交于 2019-11-30 03:38:50
问题 I am attempting to use an in-memory database to mock out a teradata database. I need to create a schema before the tables are built, however, it is giving me fits. I am using Spring and have lots of database interaction with import.sql , however, this executes after Hibernate has created all the tables. I have attempted to use the .script file that HSQLDB is supposed to read, but I think when you use an in-memory database that doesn't work. I have moved the files around a bit and nothing

Difference between In memory databases and disk memory database

不问归期 提交于 2019-11-30 01:58:40
Recently i heard about the concept of In memory database. In any type of database we are finally storing the data in the computer,from there our program will get the data .How in memory database operations are fast when compared to the others. Will the in memory database load all the data from the database into memory(RAM). Thanks in advance.... An in-memory database (IMDB; also main memory database system or MMDB or memory resident database) is a database management system that primarily relies on main memory for computer data storage. It is contrasted with database management systems that

SQLite vs HSQLDB

时间秒杀一切 提交于 2019-11-29 23:41:32
What are the main differences between SQLite and HSQLDB ? There are lots of applications using both of them, but I don't really see any major difference. SQLite is implemented in C, HSQL is implemented in Java. It should be more seamless and easy to integrate SQLite with an application project written in C or C++, whereas I would expect the HSQL technology is easier to integrate with a project written in Java. No doubt there are numerous other more subtle differences between these two embedded databases, but the above is the most prominent difference. The good comparison of HSQLDB & SQLite can

HSQLDB and Hibernate/JPA - not persisting to disk?

坚强是说给别人听的谎言 提交于 2019-11-29 23:02:23
Something of an novice with HSQL and Hibernate... em.getTransaction().begin(); for (Activity theActivity : activities) { em.persist(theActivity); } em.getTransaction().commit(); em.close(); followed by... EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); System.out.println("QUERY:: " + em.createQuery("SELECT COUNT(*) FROM " + Activity.class.getName()).getSingleResult() .toString()); em.getTransaction().commit(); Prints 25000 (the number of Activity objects in activities). But when I run this test again, the number of objects in the count(*) doesn't increase (and is 0