hsqldb

HSQLDB安装与使用

≡放荡痞女 提交于 2019-12-05 00:04:46
HSQLDB 是一个轻量级的纯Java开发的开放源代码的关系数据库系统。因为 HSQLDB 的轻量(占用空间小),使用简单,支持内存运行方式等特点, HSQLDB 被广泛用于开发环境和某些中小型系统中。 HSQLDB 的运行需要Java环境的支持。 HSQLDB 的四种运行模式: 运行模式 说明 启动命令 JDBC例 内存 (Memory-Only) 模式 所有数据都在内存里操作。应用程序退出后则数据被销毁。 启动方式1:通过程序中首次调用 Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:myDbName", "sa", "");时 启动方式2:你也可以在server.properties中指定相同的URL来运行一个Memory-Only(仅处于内存中)服务器实例。 jdbc:hsqldb:mem:myDbName 进程 (In-Process) 模式 从应用程序启动数据库。因为所有数据被写入到文件中,所以即使应用程序退出后,数据也不会被销毁。 跟Memory-Only模式一样, In-Process不需要另外启动,通过DriverManager.getConnection(jdbcUriName, "sa", "");方式既可启动 jdbc:hsqldb: file:/C:/mydb/myDbNamejdbc

Using @Table with schema name in Hibernate 3.3.1ga and HSQLDB

给你一囗甜甜゛ 提交于 2019-12-04 23:04:41
问题 How can I make this work in unit tests using Hibernate 3.3.1ga and HSQLDB: @Entity @Table(name="CATEGORY", schema="TEST") public static class Category { ... } The problem is that Hibernate expects the schema to exist. The second problem is that Hibernate issues the CREATE TABLE TEST.CATEGORY before any of my code runs (this happens deep inside Spring's test setup), so I can't get a connection to the DB before Hibernate and create the schema manually. But I need the schema because I have to

“correct” way to select next sequence value in HSQLDB 2.0.0-rc8

非 Y 不嫁゛ 提交于 2019-12-04 22:31:18
suppose i have a sequence, called TEST_SEQ what would be the correct way of selecting its next value ? this does not work: select next value for TEST_SEQ probably because it expects a "FROM" clause. looking at HSQLDialect.getSequenceNextValString() in hibernate i see this: "select next value for " + sequenceName + " from dual_" + sequenceName which in my case would result in something like: select next value for TEST_SEQ from dual_TEST_SEQ which does not work for 2.0.0-rc8 (i only assume this works in pre-2.0 versions - havent verified) I've come across a solution that involves creating a

100% in-memory HSQL database

我们两清 提交于 2019-12-04 22:16:24
问题 I have a Java application set up as a service to do data-mining against ~3GB of data every few hours. I would like this to occur 100% in memory. Ideally I want the application to be isolated from everything; I want it to construct the database, do the mining I need, and tear down the database when it's done. However with HSQLDB, even when i use the "create memory table...." command, a log is written of all of the statements and the table is recreated the next time the application runs. I'm

Atomic INSERT/SELECT in HSQLDB

随声附和 提交于 2019-12-04 21:26:02
I have the following hsqldb table, in which I map UUIDs to auto incremented IDs: SHORT_ID (BIG INT, PK, auto incremented) | UUID (VARCHAR, unique) Create command: CREATE TABLE mytable (SHORT_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, UUID VARCHAR(36) UNIQUE) In order to add new pairs concurrently, I want to use the atomic MERGE INTO statement. So my (prepared) statement looks like this: MERGE INTO mytable USING (VALUES(CAST(? AS VARCHAR(36)))) AS v(x) ON mytable.UUID = v.x WHEN NOT MATCHED THEN INSERT VALUES v.x When I execute the statement (setting the placeholder correctly), I

Database Cleanup after every junit test cases with http calls

為{幸葍}努か 提交于 2019-12-04 15:52:49
I am using junit4 with spring to test my rest web services. For this, I am using HSQL in memory database. To clean the records after every test case, I am removing all the records from tables. But I want to delete only inserted records. I am adding data to database in two places: In Junit test cases. In the rest services. I am making http calls to test the services. Also, I am using same in-memory database in rest services. Kindly help me in removing only inserted records after each test cases. Edited : My concern is deleting the inserted records in http calls to rest services. It is really

Change SessionFactory datasource jdbcurl late in runtime

限于喜欢 提交于 2019-12-04 15:23:44
I'm writing a desktop java application for an environment without a network connection. I'm trying to store the application data as securely as I can in an encrypted in-process hsqldb, with an unencrypted user information hsqldb. Hsqldb requires that the crypto_key be set in the jdbcurl when the connection is created. My application uses hibernate to do persistence and Spring to do configuration and injection. My current scheme is to store username, password hash, salt and the encrypted database's crypto_key in the unencrypted user table. The crypto_key is protected by an asymmetric encryption

Can I use HSQLDB for junit testing cloning a mySQL database

戏子无情 提交于 2019-12-04 14:35:07
I am working on a spring webflow project and I am thinking can I use HSQLDB and not my mysql for junit testing? How can I clone my mysql database into HSQLDB If you are using spring 3.1 or greater you could use spring profiles to achieve this. The default profile is loaded when no active profile is set. <beans profile="dev"> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="org.hsqldb.jdbcDriver" /> ...other datasource properties also create or drop db </bean> </beans> <beans profile="default"> <bean id=

object is not an instance of declaring class -Hibernate

蹲街弑〆低调 提交于 2019-12-04 14:34:31
I am new to HIbernate and was practicing some examples on One-to-many mapping but I am not getting why it is throwing error. 1)Employee.java package com.common.pojo; import java.util.Set; public class Employee { private int id; private String name; private Set certificate; public Employee (){} public Employee(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Set getCertificate() { return certificate; } public void setCertificate

HyperSQL (HSQLDB): massive insert performance

江枫思渺然 提交于 2019-12-04 14:19:06
问题 I have an application that has to insert about 13 million rows of about 10 average length strings into an embedded HSQLDB. I've been tweaking things (batch size, single threaded/multithreaded, cached/non-cached tables, MVCC transactions, log_size/no logs, regular calls to checkpoint , ...) and it still takes 7 hours on a 16 core, 12 GB machine. I chose HSQLDB because I figured I might have a substantial performance gain if I put all of those cores to good use but I'm seriously starting to