hsqldb

轻松使用hsqldb小型数据库

匿名 (未验证) 提交于 2019-12-02 21:52:03
1、在pom.xml中引入相关jar包 1 <!-- spring data jpa --> 2 <dependency> 3 <groupId> org . springframework . boot </ groupId > 4 <artifactId> spring - boot - starter - data - jpa </ artifactId > 5 </ dependency > 6 7 8 <!-- 内存数据库 hsqldb --> 9 <dependency> 10 <groupId> org . hsqldb </ groupId > 11 <artifactId> hsqldb </ artifactId > 12 <scope> runtime </ scope > 13 </ dependency > 2、配置yml,将数据写入硬盘 1 spring : 2 jpa : 3 show - sql : false 4 hibernate : 5 ddl - auto : update 6 datasource : 7 url : jdbc : hsqldb : file : C : /rct/ db / rct - db 8 username : admin 9 password : admin 10 driverClassName : org .

Spring/Hibernate/Junit example of testing DAO against HSQLDB

吃可爱长大的小学妹 提交于 2019-12-02 20:34:01
I'm working on trying to implement a JUnit test to check the functionality of a DAO. (The DAO will create/read a basic object/table relationship). The trouble I'm having is the persistence of the DAO (for the non-test code) is being completed through an in-house solution using Spring/Hibernate , which eliminates the usual *.hbm.xml templates that most examples I have found contain. Because of this, I'm having some trouble understanding how to setup a JUnit test to implement the DAO to create/read (just very basic functionality) to an in-memory HSQLDB . I have found a few examples, but the

net.ucanaccess.jdbc.UcanaccessSQLException: attempt to assign to non-updatable column

情到浓时终转凉″ 提交于 2019-12-02 20:02:55
问题 try{ //taking input from user about how much balance Scanner input = new Scanner(System.in); Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); String url = "jdbc:ucanaccess://c://Bibek//Atmcard.accdb"; System.out.print("\nConnecting to database..."); con = DriverManager.getConnection(url); st = con.createStatement(); System.out.println("\n Enter balance you want to withdraw:\n"); balance = Double.parseDouble(input.nextLine()); String sql = "select AccountBalance From Atm"; result = st

Best SQL browser for HSQLDB? [closed]

倾然丶 夕夏残阳落幕 提交于 2019-12-02 16:53:06
Whats the best browser tool for HSQLDB databases? hawkeye HSQL has built-in GUI query tool called Database manager . In the directory of the database files run: java -cp ../lib/hsqldb.jar org.hsqldb.util.DatabaseManager and then setting the config to: jdbc:hsqldb:file:databaseName Allowed me to edit what I needed in a really convenient way. DBeaver works very nicely: http://dbeaver.jkiss.org Also, SQuirreL is always a safe bet for any database: http://squirrel-sql.sourceforge.net Meanwhile, IntelliJ has decent database tooling, too https://www.jetbrains.com/datagrip/ I've had good experience

Create an in-memory database structure from an Oracle instance

牧云@^-^@ 提交于 2019-12-02 15:10:35
I have an application where many "unit" tests use a real connection to an Oracle database during their execution. As you can imagine, these tests take too much time to be executed, as they need to initialize some Spring contexts, and communicate to the Oracle instance. In addition to that, we have to manage complex mechanisms, such as transactions, in order to avoid database modifications after the test execution (even if we use usefull classes from Spring like AbstractAnnotationAwareTransactionalTests ). So my idea is to progressively replace this Oracle test instance by an in-memory database

Hsqldb table encoding

断了今生、忘了曾经 提交于 2019-12-02 11:19:15
问题 How do I set the character encoding for a specific table? E.g: CREATE TABLE COMMENTS ( ID INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 0, INCREMENT BY 1) NOT NULL, TXT LONGVARCHAR, PRIMARY KEY (ID) ) By default it's encoded as ASCII but I'd rather use UTF-8 for this one table. 回答1: Are you sure that it's encoded as ASCII by default? My reading of it was that it's UTF-8 by default, though I'm open to correction here. If it's a TEXT table you'll can specify the encoding for the table

IOException when I try to start Liferay after migration from HSQL to PostgreSQL

南笙酒味 提交于 2019-12-02 08:52:29
I converted native lportal DB from Hypersonic to PostgreSQL. Added portal-ext.properties files with my PostgreSQL configurations and added postgresql-42.1.1 to D:\files\liferay-ce-portal-7.0-ga3\tomcat-8.0.32\lib\ext # PostgreSQL # jdbc.default.driverClassName=org.postgresql.Driver jdbc.default.url=jdbc:postgresql://localhost:5432/test jdbc.default.username=postgres jdbc.default.password=root And when I'm starting my liferay it shows me an Exception. But If I remove portal-ext.properties it will work fine! What the problem?? 08:36:35,748 ERROR [Framework Event Dispatcher: Equinox Container:

hsqldb Oracle mode select for update NOWAIT

廉价感情. 提交于 2019-12-02 08:51:39
It seems NOWAIT is not supported by HSQLDB in Oracle syntax. HSQLDB version: 2.3.3 with SET DATABASE SQL SYNTAX ORA TRUE; Exception produced on the SQL select a, b, c from sometable where id=1 for update NOWAIT The exception Caused by: org.hsqldb.HsqlException: unexpected token: NOWAIT at org.hsqldb.error.Error.parseError(Unknown Source) at org.hsqldb.ParserBase.unexpectedToken(Unknown Source) at org.hsqldb.ParserCommand.compileStatement(Unknown Source) at org.hsqldb.Session.compileStatement(Unknown Source) at org.hsqldb.StatementManager.compile(Unknown Source) at org.hsqldb.Session.execute

Cross join not recognized in HSQL

三世轮回 提交于 2019-12-02 05:59:56
问题 I am using HSQL ver 1.7. There is a part where I have a HQL like the following String hql = "from ProductInv prodInv where prodInv.product.id in (:prodList)"; prodList contains list of product ids and the above hql is to get product inventories of the required product ids in prodList. This hql is translated to a native sql query with "cross join". When this works against my actual db2, it works fine. But my unit tests based on HSQL fails. It says "cross join" is not a recognized keyword. 回答1:

Workaround in UCanAccess for multi-value fields: “incompatible data type in conversion: from SQL type OTHER”?

五迷三道 提交于 2019-12-02 03:22:50
问题 I am trying to use UCanAccess to query a MS Access .accdb file. Everything works great, except when I query multi-value fields. For example those that have entries in the Row Source of a table field's Lookup tab in design view in MS Access. My code crashes when I try to output the result: ResultSet rslt = stmt.executeQuery("SELECT [singleValue], [multiValue] FROM [TableName];"); int count = 0; while (rslt.next()) System.out.println(count++ + "\t" + rslt.getString(1) + "\t" + rslt.getString(2)