We currently use a handful of H2 databases in our application.  I
believe these are being used in embedded mode, as it is impossible to
use H2 Console once the application has established a connection to
the db.  Our professional services guys will need to peek into our
DBs, so I've been searching for a solution.

After reading the Tutorial, it seems switching from embedded to server/
mixed mode would do the trick.   However, I'm not sure where to change
that with our setup.   Our Java app uses JDBC, with Spring + Hibernate
as a buffer between our application code and the database, and
Glassfish for our server.   Shoot, it even creates the db for us on
first use.

Spring XML:

  <bean id="myDatasource"
        class="org.springframework.jndi.JndiObjectFactoryBean"
        destroy-method="close">
    <property name="jndiName" value="jdbc/myDatasourceTX"/>
  </bean>

  <bean id="hibernateSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="myDatasource"/>
    <property name="configLocation"
value="classpath:hibernate.cfg.xml"/>
    <property name="schemaUpdate" value="true"/>
    <property name="mappingResources">
      <list>
        <value>hibernate.cfg.xml</value>
      </list>
    </property>
  </bean>

Hibernate XML:

<hibernate-configuration>
  <session-factory name="myFactory">
    <property
name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
    <mapping class="blahblahblahblah.....
  </session-factory>
</hibernate-configuration>

Datasource XML:

<resources>
  <jdbc-connection-pool
      name="myServiceH2Pool"
      datasource-classname="org.h2.jdbcx.JdbcDataSource"
      res-type="javax.sql.DataSource">
    <property name="user" value="sa"/>
    <property name="password" value="note"/>
    <property name="url" value="jdbc:h2:file:$PATH"/>
  </jdbc-connection-pool>

  <jdbc-resource
      enabled="true"
      jndi-name="jdbc/myDatasourceTX"
      object-type="user"
      pool-name="myServiceH2Pool"/>
</resources>

Do I need to manually invoke the org.h2.tools.Server, or can I set
that somewhere in the XML?  Any help would be greatly appreciated.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to