java - Where are my tables in H2? -


i deploy web app wildfly 8.02 final server. use default out of box datasource comes server jndi name space:

java:jboss/datasources/exampleds 

and use default url:

jdbc:h2:mem:test;db_close_delay=-1;db_close_on_exit=false 

to access h2 intellij idea database client tool or other client applications (i use url connection, because tcp connection via default port doesn't work).

the app empty war entity beans , persistence.xml file. intend test purely tables created in underlying data source in accordance annotations.

here thing: when set in persistence.xml:

<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> 

war succesfully deployed, when connect via client tool h2 data source can see pre-defined tables after:

select * information_schema.tables 

i can create tables via client tools , able track existence previous sql query. seems tables hadn't been created jpa framework.

but when change persistence.xml different schema creation mode:

<property name="javax.persistence.schema-generation.database.action" value="create"/> 

deployment fail jdbc exception telling jpa tries create existing tables, @ same time client tools still not show user created tables.

thx.

take @ http://www.h2database.com/html/features.html#in_memory_databases :

to access in-memory database process or computer,  need start tcp server in same process in-memory database  created. other processes need access database on tcp/ip  or tls, using database url such as: jdbc:h2:tcp://localhost/mem:db1. 

look here example:

h2 database in memory mode cannot accessed console


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -