h2

How to fake ENUM columns in the H2 database for play unit testing?

匆匆过客 提交于 2019-12-04 14:06:25
I have a set of Play! unit tests that I have been running against an H2 database. I have added some enum columns to my model, and the tests now fail because of the sql statements used to create my model tables. The error message is: 14:42:10,435 ERROR ~ Unknown data type: "ENUM"; SQL statement: Some searching shows that there are ways to emulate enums in H2 (eg: http://groups.google.com/group/h2-database/search?group=h2-database&q=enum&qt_g=Search+this+group ) Setting Play to use the H2Dialect for test mode does not fix the issue. It seems like the root cause is that H2 does not support enums,

connection has a remote Database

☆樱花仙子☆ 提交于 2019-12-04 12:26:05
问题 I use H2 Database as DBMS from a remote computer,so I enabled remote access from a browser as follows: webAllowOthers=true but when i try to connect to the server from my java application i get this error from H2: remote connections to this server are not allowed screenshot: And also already looking into the code Analyzer with (Error Code: 90117): REMOTE_CONNECTION_NOT_ALLOWED = 90117 The error with code 90117 is thrown when trying to connect to a TCP server from another machine, if remote

Cannot import org.h2.server.web.WebServlet

醉酒当歌 提交于 2019-12-04 10:52:45
问题 I am trying to configure my spring boot application to use h2 console. I found some articles and all of them use webServlet. But I can not import the class although I have h2 dependency added in my pom.xml. I get this error message can not resolve the symbol WebServlet . My import line import org.h2.server.web.WebServlet; Below is my pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org

Using AbstractTransactionalJUnit4SpringContextTests with commit halfway through

冷暖自知 提交于 2019-12-04 10:51:28
We want a simple unit test that runs multiple threads - the idea is that the main thread commits a save to the database, then waits for a secondary thread to pick it up. We're finding that the transaction has to be committed for the second Thread to be able to query the database and find the item. Otherwise, it won't exist. We're trying to accomplish this using an H2 database, Hibernate to manage the access, and the unit test extends AbstractTransactionalJUnit4SpringContextTests . When we try to commit() the existing transaction: ... // Create and save our model object sessionFactory

Integrate H2 database with Android [closed]

落花浮王杯 提交于 2019-12-04 10:24:53
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Is there any tutorial for integrating H2 database with Android and to start working on it? I'm searching for guide to do this. Thanks. The Android documentation in H2 is the only documentation I know about. 来源: https://stackoverflow.com/questions/7204785/integrate-h2-database-with-android

JPA connection with H2 database

依然范特西╮ 提交于 2019-12-04 09:29:39
问题 I am developing a hibernate with JPA project and trying to get the working persistence.xml by using H2(Embedded database). Persistence.xml <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="DefaultPersistenceUnit" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>entity.user</class> <properties> <property name="hibernate.connection.url" value="jdbc:h2:/~test" /> --> <property name="hibernate

Why is my H2 database 7x larger on disk than it should be?

梦想与她 提交于 2019-12-04 07:01:00
问题 I have an H2 database that has ballooned to several Gigabytes in size, causing all sorts of operational problems. The database size didn't seem right. So I took one little slice of it, just one table, to try to figure out what's going on. I brought this table into a test environment: The columns add up to 80 bytes per row, per my calculations. The table has 280,000 rows. For this test, all indexes were removed. The table should occupy approximately 80 bytes per row * 280,000 rows = 22.4 MB on

how to create new database in H2?

社会主义新天地 提交于 2019-12-04 05:38:09
I have a site running locally on MySQL i want to run it on H2 database. I have just run h2.jar file for console on the browser but whenever I Log in I have seen the list jdbc:h2:/var/www/mysite/data/db; MODE=MySQL, information_schema and users. I can create tables in it but don't know how to create new database? I am using Mode = MySQL type = H2 Database Engine in Embedded mode. From http://www.h2database.com/html/tutorial.html#creating_new_databases , By default, if the database specified in the URL does not yet exist, a new (empty) database is created automatically. The user that created the

Can H2 Database query a CSV file containing multiple sections of different record groups?

眉间皱痕 提交于 2019-12-04 05:31:01
问题 I receive data in a CSV (kind of) format, in which each entity is represented by multiple sections of different record groups. In this fictitious example (below) I represent a number of colleges (the entities) by a number of sections of different record groups (these can be thought of as the tables). I have no control over the format of this incoming data. So I was wondering, when issueing a query on incoming CSV data using the H2 Database engine, can you somehow specify which line to begin