h2

H2 - Error accessing linked table with SQL statement “SELECT * FROM null T”

蓝咒 提交于 2019-12-11 05:34:44
问题 I try to created linked table in my Java application. Statement stmtH2 = DBconnect.connH2.createStatement() String linkedTable = ("CREATE LINKED TABLE tableName('', 'jdbc:mysql://localhost:3306/DBname', 'root', '', 'tableName');"; stmtH2.execute(linkedTable) String query = "SELECT * FROM tableName WHERE Sex = 'F' ORDER BY Cod"; stmtH2.executeUpdate(query); In Java I've got this error: org.h2.jdbc.JdbcSQLException: Column "COD" not found; SQL statement: When I try to see the table in localhost

How to Update/Change user account name in H2 database using JDBC?

☆樱花仙子☆ 提交于 2019-12-11 05:29:13
问题 What query should be used to change the username of H2 database in embedded mode with JDBC? I need to update the username with the input string from the user. 回答1: Use this query Note:The password will become invalid when the user name was changed alter user "+username+" rename to "+newusername+"//alter username alter user"+newusername+" set password '"+password+"' //alter password 来源: https://stackoverflow.com/questions/39347825/how-to-update-change-user-account-name-in-h2-database-using

How to set h2 to stream resultset?

我与影子孤独终老i 提交于 2019-12-11 05:27:38
问题 Mysql driver has options to set so that resultset will not be read completely in memory as in here http://dev.mysql.com/doc/connector-j/en/connector-j-reference-implementation-notes.html#ResultSet. Is there an equivalent option for H2? Thanks, 回答1: H2 currently does not support server side cursors. However, it buffers large result sets to disk (as a separate file, or as a temporary table). The disadvantage is speed, but it should not be a memory usage problems. You can set the size of the

Liquibase: Does not honor schema name for H2, but MySQL is fine

泪湿孤枕 提交于 2019-12-11 04:16:12
问题 I am using maven cargo to deploy my Spring application. I am trying to run this against MySQL and H2 embedded database. The configuration for H2 looks like @Configuration @Profile("development") public class H2DatabaseConfig extends JpaCommonConfig { @Override public DataSource dataSource() { // (todo: harit) get rid of hard coding System.out.println("This is H2 Database Profile"); final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.h2.Driver");

How do I share an H2 database over a peer-to-peer network?

怎甘沉沦 提交于 2019-12-11 03:59:32
问题 I've been working a bit with H2 over the past couple of days, and I am having some trouble. I run the program on one computer and add some data. Then, I try to run the same program on another computer (even through a shared folder over the peer-to-peer network), and it seems as though the database is stored locally, on each computer. Now, I have a database set up with the URL jdbc:h2:C://DatabaseTesting/NewDatabase . I couldn't get it placed in certain other folders, but I figured this one

Java application that can run entirely from a DVD

霸气de小男生 提交于 2019-12-11 03:27:04
问题 I have to create a java application that can run entirely from a DVD. The application must connect with a database that will be also on the DVD. I was thinking to use an embedded database but i dont know much about them. Do i have to start the database server from my java application and if i do, how should i do it? Thanks in advance. Nick Tsilivis 回答1: You can use SQLite which is a very light weighted version of SQL. It stores its data in a single file. You even don't have to log in with an

Where() in (select) H2

随声附和 提交于 2019-12-11 03:06:06
问题 I have 2 kinds of software (both Java): One with MySSQL and the other with H2 database. My problem is that in MySQL I have this query: Select * from X where (1,2,3) in (select 4,5,6 from Y) But in H2 throw me this error: Subquery is not a single column query; SQL statement: I understand basically what this mean but I need to select all values from X that are in Y and I read that this is the most efficient way. The other way could be asign all the values from Y to a Java Object and then put

Table not found after apparently successful migration

◇◆丶佛笑我妖孽 提交于 2019-12-11 01:38:12
问题 I was using flyway through the CL to migrate my production DB (mySql), while I was using a fixed SQL query to create the DB, tables, etc. in my unit tests, using H2. I'd like now to better integrate flyway and create/delete DB after each unit test. I have a DB factory and inside its build method I'm using the following code: flyway.setLocations("filesystem:sql/migrations/common","filesystem:sql/migrations/h2"); flyway.setSchemas("MYSERVER"); flyway.setDataSource( p.getProperty(DB_URL.getName(

runscript executed multiple times for @Autowired jdbcTemplate and h2 in-memory database

十年热恋 提交于 2019-12-11 01:17:59
问题 I've inherited a project and am trying to get a set of integration tests running against an in-memory h2 database. In order for them to pass some tables, relationships and reference data needs creating. I can see the problem in that the script referenced in RUNSCRIPT is being executed multiple times and therefore generating Index "XXX_IDX" already exists errors and other violations. So is there a way to force the script to only be run once or do I need a external database? It seems that the

Current moment in H2 database

自作多情 提交于 2019-12-11 01:08:09
问题 How to get the actual current clock time, the current moment, in H2 database? The CURRENT_TIMESTAMP function gives the moment when the current database transaction began. Is there a way to get the current moment, the time when the current statement is executing ? This may be the same or later than CURRENT_TIMESTAMP . For comparison, in Postgres, some functions such as current_timestamp return the transaction start time while some functions such as clock_timestamp return the actual current