On Wed, Oct 15, 2008 at 10:45 PM, TiKi <[EMAIL PROTECTED]> wrote:

> Hi mingfai,
>
>    I am a newbie and want to use H2 in Server Mode along with spring.
> If i where using these for not in memory database and in server mode,
> do i just have to change the url to "jdbc:h2:~/
> perfomanceevaluation;DB_CLOSE_DELAY=-1"? and how to make sure that
> server is shutdown when the H2 database is running in Server Mode?
>
>
> Regards,
> TiKi
>


hi Tiki,

u'd better ask question in the the h2-database group.

it's not the first email i got about H2 Spring. In case any one has interest
or research about how to use H2 with Spring and with c3p0 connection pool,
you may consider the following configuration that is cleaner than the
version I posted on this group in Apr.


    <bean id="org.h2.tools.Server" class="org.h2.tools.Server"
scope="singleton" factory-method="createTcpServer"
          init-method="start" depends-on="org.h2.tools.Server-WebServer">
        <constructor-arg value="-tcp,-tcpAllowOthers,true,-tcpPort,9092"/>
    </bean>

    <bean id="org.h2.tools.Server-WebServer" class="org.h2.tools.Server"
scope="singleton" factory-method="createWebServer" init-method="start">
        <constructor-arg value="-web,-webAllowOthers,true,-webPort,8082"/>
    </bean>

    <!-- notice that loading the Driver as a bean is unnecessary is most
cases! u could safely remove this and the depends-on in the next bean -->
    <bean id="H2DatabaseJDBCDriver" class="org.h2.Driver" scope="singleton"
init-method="load" depends-on="org.h2.tools.Server"/>

    <bean id="h2databasePoolingDataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
depends-on="H2DatabaseJDBCDriver" destroy-method="close">
        <property name="driverClass" value="org.h2.Driver"/>
        <property name="jdbcUrl"
value="jdbc:h2:mem:appdb1;DB_CLOSE_DELAY=-1;TRACE_LEVEL_FILE=4"/>
        <!-- ;TRACE_LEVEL_FILE=3;TRACE_LEVEL_SYSTEM_OUT=3 -->
        <property name="user" value="sa"/>
        <property name="password" value=""/>

        <property name="maxPoolSize" value="20"/>
        <property name="minPoolSize" value="5"/>
        <property name="acquireIncrement" value="5"/>

        <property name="maxConnectionAge" value="28800"/>
        <property name="preferredTestQuery" value="SELECT 1"/>
    </bean>


I somehow doubt if it is necessary to use connection pool for inmemory mode.
but i suppose it won't be very harmful to do so.

regards,
mingfai

--~--~---------~--~----~------------~-------~--~----~
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