hsqldb

SimpleJdbcTestUtils.executeScript and multilines script

試著忘記壹切 提交于 2019-12-10 03:06:18
问题 I want to load SQL script files for my unit tests. As I am using Spring 2.5.2, I decided to use the SimpleJdbcTestUtils.executeScript() method to load my script file, using the following code: DriverManagerDataSource dataSource = ... // getting my DataSource defined in my Spring context SimpleJdbcTemplate template = new SimpleJdbcTemplate(dataSource); Resource resource = new ClassPathResource("/create-table.sql"); SimpleJdbcTestUtils.executeSqlScript(template, resource, true); If I write each

HSQL: Creating index if not existing

好久不见. 提交于 2019-12-09 17:27:34
问题 I'm initializing a HSQL database 2.2.9 via Spring using <jdbc:initialize-database enabled="true"> <jdbc:script execution="INIT" location="classpath:./create-tables.sql"/> </jdbc:initialize-database> In create-tables.sql I use CREATE TABLE IF NOT EXISTS MyTable(...); The table also has an index. I'm looking for a better way than always dropping and creating the index. I tried: CREATE INDEX IF NOT EXISTS myIndex ...; does not work I can create a function indexExisting() checking the system

How to connect to HSQL which Spring creates when jdbc:embedded-database is used?

て烟熏妆下的殇ゞ 提交于 2019-12-09 09:48:11
问题 I have a HSQL database which Spring automatically creates for me: <jdbc:embedded-database id="dataSource" type="HSQL"> <jdbc:script location="classpath:scheme.sql" / </jdbc:embedded-database> And now I want to connect to this database. My question is how to do this, because I don't known which address I should use. 回答1: This embedded HSQL database is all-in-memory and in-process, therefore accessible only from the Spring Java process. If you want to access the database from another tool as

How to run a HSQLDB server in memory-only mode

别等时光非礼了梦想. 提交于 2019-12-09 09:38:55
问题 In the documentation of the HSQLDB is a command line statement to start a HSQLDB server (HSQLDB Doc). But there is this "file:mydb" property, so I assume its not in memory-only mode. How do I run a memory-only HSQLDB server? I ran the following but get no clue. java -cp ../lib/hsqldb.jar org.hsqldb.Server -? 回答1: use java -cp .\hsqldb-1.8.0.10.jar org.hsqldb.Server -database.0 mem:aname In memory mode is specified by the connection url - so if you want, you can just have a server.properties

Hibernate/JPA/HSQL : How to create a Dialect mapping for User Type ARRAY

六眼飞鱼酱① 提交于 2019-12-09 07:39:26
I have successfully created User Types with Postgres, and can read and write successfully. @org.hibernate.annotations.Type(type = "com.xxx.datamodel.ext.FooType" ) @Column(name = "foo", nullable = false) private int[] foo @org.hibernate.annotations.Type(type = "com.xxx.datamodel.ext.BarType" ) @Column(name = "bar", nullable = false) private double[] bar However, when I try to use the HSQLDialect (for unit testing) I get: Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: 2003 at org.hibernate.dialect.TypeNames.get(TypeNames.java:79) at org.hibernate.dialect.TypeNames

Running a script to create tables with HSQLDB

﹥>﹥吖頭↗ 提交于 2019-12-09 04:24:37
问题 I use hsqldb to run my unit tests that need a database access. For the moment, when I want to create a table for a specific test, I have the following code: private void createTable() { PreparedStatement ps; try { ps = getConnection().prepareStatement("CREATE TABLE T_DATE (ID NUMERIC PRIMARY KEY, DATEID TIMESTAMP)"); ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } The getConnection() method retrieve a DataSource defined in a Spring context: <bean id="dataSource" class=

maven start postgres server [duplicate]

北城以北 提交于 2019-12-08 07:33:07
问题 This question already has answers here : Running PostgreSQL in memory only (7 answers) Closed 5 years ago . I am working on a project for school and need to replace hsqldb with postgresql in a maven project. Currently we start the hsql Server by running mvn exec:java -P hsqldb To my knowlege this looks up the hsqldb profile in the pom.xml <profile> <id>hsqldb</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version

Auto-incrementation with HSQLDB (2.2.8) + DDLUtils

我只是一个虾纸丫 提交于 2019-12-08 06:35:49
问题 I want to use HSQLDB as an embedded database but am having trouble getting it to auto-increment . As far as I understand, [CALL] IDENTITY() can be used to get the last primary key value. However, experiments through both iBatis and HSQLDB's DatabaseManagerSwing continually return a 0 value. How can I get auto-incrementation to work with HSQLDB? Edit: I didn't mention that I'm using DDLUtils to autogenerate tables. The following does not suit HSQLDB: <?xml version="1.0"?> <!DOCTYPE database

How to import data to an in-memory database?

喜夏-厌秋 提交于 2019-12-08 03:36:48
问题 Are there any ways to import data in databases such as MS SQL, MySQL into in-memory databases like HSQLDB, H2 etc ? 回答1: H2 supports a special database URL that initialized the database from a SQL script file: "jdbc:h2:mem;INIT=RUNSCRIPT FROM '~/create.sql'" HSQLDB and Apache Derby don't support such a feature as far as I know. 回答2: I think you need to do query the data out from MS SQL import the data into in-memory DB with its API Either SQL expressions or DB related APIs 回答3: In Hibernate:

HSQLDB - invalid authorization specification

我怕爱的太早我们不能终老 提交于 2019-12-08 01:59:18
问题 I need help with an issue during the database connection via JPA/Hibernate on hsqldb-2.2.8: [AWT-EventQueue-0] ERROR org.hibernate.util.JDBCExceptionReporter - invalid authorization specification - not found: manasouza I created some user (manasouza) with some password as: CREATE USER manasouza PASSWORD 123 ADMIN I'm using SQLWorkbench as my database visualizer, and with it I can log on normally. Using JPA/Hibernate I already tried the username on uppercase and the password as '123' or as the