hsqldb

Inspect in memory hsqldb while debugging

喜夏-厌秋 提交于 2019-11-29 19:06:06
We're using hdsqldb in memory to run junit tests which operate against a database. The db is setup before running each test via a spring configuration. All works fine. Now when a tests fails it can be convinient to be able to inspect the values in the in memory database. Is this possible? If so how? Our url is: jdbc.url=jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true The database is destroyed after each tests. But when the debugger is running the database should also still be alive. I've tried connecting with the sqldb databaseManager. That works, but I don't see any tables or data. Any

Hibernate postgresql/hsqldb TEXT column incompatibility problem

对着背影说爱祢 提交于 2019-11-29 17:53:17
问题 I have a problem using Hibernate and PostgreSQL for production and HSQLDB for testing. I am using top-down approach letting Hibernate create database schema. I am also using annotations; mapping part of hibernate.cfg.xml only contains lines like <mapping class="package.subpackage.ClassName" /> Hibernate defaults String variables to character varying(255) on PostgreSQL which is not sufficient for me in some cases, so I have to redefine some columns manually using @Column(columnDefinition =

How to do “select current_timestamp” in hsqldb?

牧云@^-^@ 提交于 2019-11-29 12:17:05
问题 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 回答1: 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. 回答2: In a select I use SELECT CURRENT_DATE AS today, CURRENT_TIME AS now FROM (VALUES(0)) 回答3:

How do I reset my database state after each unit test without making the whole test a transaction?

六月ゝ 毕业季﹏ 提交于 2019-11-29 09:08:12
I'm using Spring 3.1.1.RELEASE, Hibernate 4.1.0.Final, JPA 2, JUnit 4.8.1, and HSQL 2.2.7. I want to run some JUnit tests on my service methods, and after each test, I would like any data written to the in-memory database to be rolled back. However, I do NOT want the entire test to be treated as a transaction. For example in this test @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "classpath:test-context.xml" }) public class ContractServiceTest { … @Autowired private ContractService m_contractService; @Test public void testUpdateContract() { // Add the contract m

Where can I see the HSQL database and tables

余生长醉 提交于 2019-11-29 08:06:50
I have downloaded a hsqldb.jar and I set to project buildpath,then next I wrote the program Class.forName("org.hsqldb.jdbc.JDBCDriver"); Connection conn = DriverManager.getConnection( "jdbc:hsqldb:mem:mydb", "SA", ""); String bookTableSQL = "create table MY_TABLE ("+ " TITLE varchar(256) not null primary key,"+ " AUTHOR varchar(256) not null"+ ");"; Statement st = conn.createStatement(); st.execute(bookTableSQL); System.out.println(st); String sql = "INSERT INTO MY_TABLE " + "VALUES ('Mahnaz', 'Fatma')"; st.executeUpdate(sql); Database and table created successfully. In the next step, I

Am I crazy? Switching an established product from HSQLDB to Apache Derby

[亡魂溺海] 提交于 2019-11-29 06:35:31
问题 I have an established software product that uses HSQLDB as its internal settings database. Customer projects are stored in this database. Over the years, HSQLDB has served us reasonably well, but it has some stability/corruption issues that we've had to code circles around, and even then, we can't seem to protect ourselves from them completely. I'm considering changing internal databases. Doing this would be fairly painful from a development perspective, but corrupted databases (and lost data

File based h2 persisted but not loaded in Spring Boot

自古美人都是妖i 提交于 2019-11-29 05:31:50
I made a small application based on Spring Boot: spring-boot-starter-web spring-boot-starter-data-jpa The application has simply one domain class Post.java . Accordingly there is a RestController and a DAO. The data is supposed to be persisted in a file based hsql db. When the application is running everything seems fine. Data is stored. The h2 file is created and contains insert statements. However, when I kill the application and start it a second time. No data is loaded. (As if a brand new db file was created, which overwrote the old one). application.properties spring.datasource.url = jdbc

Cause of No suitable driver found for

和自甴很熟 提交于 2019-11-28 19:24:52
I'm trying to unit test (JUnit) a DAO i've created. I'm using Spring as my framework, my DAO (JdbcPackageDAO) extends SimpleJdbcDaoSupport. The testing class (JdbcPackageDAOTest) extends AbstractTransactionalDataSourceSpringContextTests. I've overridden the configLocations as follows: protected String[] getConfigLocations(){ return new String[] {"classpath:company/dc/test-context.xml"}; } My test-context.xml file is defined as follows: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework

How to initialize in-memory HSQLDB using script via Spring

送分小仙女□ 提交于 2019-11-28 15:54:10
I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per this tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in Spring. Here is the pertinent Spring context config: <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="org.hsqldb.jdbcDriver" /> <property name="url" value="jdbc:hsqldb:mem:mydb" /> <property name="username" value="sa" /> <property name="password" value="" /> <property name=

Inspect in memory hsqldb while debugging

孤人 提交于 2019-11-28 14:32:01
问题 We're using hdsqldb in memory to run junit tests which operate against a database. The db is setup before running each test via a spring configuration. All works fine. Now when a tests fails it can be convinient to be able to inspect the values in the in memory database. Is this possible? If so how? Our url is: jdbc.url=jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true The database is destroyed after each tests. But when the debugger is running the database should also still be alive. I've