h2

How to see all tables in my h2 database at localhost:8082?

我只是一个虾纸丫 提交于 2019-12-02 20:14:40
I use JDBC and created h2 database called usaDB from sql script. Then I filled all tables with jdbc. The problem is that after I connect to usaDB at localhost:8082 I cannot see on the left tree my tables. There is only INFORMATION_SCHEMA database and rootUser which I specified creating usaDB. How to view the content of tables in my h2 database? I tried query SELECT * FROM INFORMATION_SCHEMA.TABLES . But it returned many table names except those I created. My snapshot: I had the same issue and the answer seems to be really stupid: when you type your database name you shouldn't add " .h2.db "

Reset Embedded H2 database periodically

笑着哭i 提交于 2019-12-02 19:54:21
I'm setting up a new version of my application in a demo server and would love to find a way of resetting the database daily. I guess I can always have a cron job executing drop and create queries but I'm looking for a cleaner approach. I tried using a special persistence unit with drop-create approach but it doesn't work as the system connects and disconnects from the server frequently (on demand). Is there a better approach? Thomas Mueller H2 supports a special SQL statement to drop all objects : DROP ALL OBJECTS [DELETE FILES] If you don't want to drop all tables, you might want to use

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

Starting an H2 Database Server from Maven?

放肆的年华 提交于 2019-12-02 14:39:28
Suppose I want to create and use an H2 database for my integration tests. Maven has a command to run tests: mvn test . Is there a way to tell maven to start an H2 database server for the tests and stop it when it's done? I imagine this working similar to how I can run tomcat via a Maven command ( mvn tomcat:run ). Sorry if this question is nonsensical, I'm still wrapping my head around new concepts. I was able to get it to work without using an external server just by adding the dependency to H2 via Maven and then using this bean: <bean id="dataSource" class="org.springframework.jdbc

How to get the default schema of a SQL connection?

拟墨画扇 提交于 2019-12-02 14:29:17
问题 From within a java code - where I already have a connection to a database - I need to find the default schema of the connection. I have the following code that gives me a list of all schemas of that connection. rs = transactionManager.getDataSource().getConnection().getMetaData().getSchemas(); while (rs.next()) { log.debug("The schema is {} and the catalogue is {} ", rs.getString(1), rs.getString(2)); } However, I don't want the list of all the schemas. I need the default schema of this

What is wiping my H2 database every time I run a unit test?

给你一囗甜甜゛ 提交于 2019-12-02 12:40:03
问题 I have a Spring+Hibernate+H2 project that I made by basing of an example I found on the Internet. It's working great except that every time I run a unit test, the db is wiped. I'm not sure what's causing it. The tests pass fine, but anything I put in the db before the test is wiped out after the test is run. Any thoughts would be helpful! Thanks! Here's my infrastructure.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www

How to get the default schema of a SQL connection?

帅比萌擦擦* 提交于 2019-12-02 09:00:33
From within a java code - where I already have a connection to a database - I need to find the default schema of the connection. I have the following code that gives me a list of all schemas of that connection. rs = transactionManager.getDataSource().getConnection().getMetaData().getSchemas(); while (rs.next()) { log.debug("The schema is {} and the catalogue is {} ", rs.getString(1), rs.getString(2)); } However, I don't want the list of all the schemas. I need the default schema of this connection. Please help. Note1: I am using H2 and DB2 on Windows7 (dev box) and Linux Redhat (production box

OGG_新添加表同步

早过忘川 提交于 2019-12-02 08:49:02
1、停止抽取进程 stop e_tb edit params e_tb --20191025 add table h2.t_rpt; table h2.t_store; 2、打开表级附加日志 dblogin userid ogg password ogg; ADD TRANDATA h2.t_rpt ADD TRANDATA h2.t_store 3、stop 投递进程 stop p_tb edit params p_tb --20191025 add table h2.t_rpt; table h2.t_store; 4、停止r进程 stop r_tb 5、从源端导出数据,导入到目标端 查询源端数据库scn col current_scn for 9999999999999999 select current_scn from v$database; 15585673221354 expdp \" / as sysdba \" directory=a_li tables=h2.t_rpt,h2.t_store dumpfile=h2_1025.dmp logfile=h2_1025.log compression=all FLASHBACK_SCN=15585673221354 impdp \" / as sysdba \" directory=a_li table_exists

嵌入式 内存 数据库H2 Mixed Mode布署

笑着哭i 提交于 2019-12-02 08:35:34
Connection Modes The following connection modes are supported: Embedded mode (local connections using JDBC) Remote mode (remote connections using JDBC or ODBC over TCP/IP) Mixed mode (local and remote connections at the same time) Embedded Mode In embedded mode, an application opens a database from within the same JVM using JDBC. This is the fastest and easiest connection mode. The disadvantage is that a database may only be open in one virtual machine (and class loader) at any time. As in all modes, both persistent and in-memory databases are supported. There is no limit on the number of

How to connect H2 console to embedded Spring H2 DB

孤者浪人 提交于 2019-12-02 06:21:12
Ok, Im developing simple app, which has Spring Ebedded H2 database for development. database.xml bean conf looks like this: <bean id="h2Server" class="org.h2.tools.Server" factory-method="createTcpServer" init-method="start" destroy-method="stop" depends-on="h2WebServer"> <constructor-arg value="-tcp,-tcpAllowOthers,-tcpPort,9092" /> </bean> <bean id="h2WebServer" class="org.h2.tools.Server" factory-method="createWebServer" init-method="start" destroy-method="stop"> <constructor-arg value="-web,-webAllowOthers,-webPort,8082" /> </bean> <jdbc:embedded-database id="dataSource" type="H2" /> H2