Thomas,
I am in the assumption that if I use separate database for each table
the syn on the executeQuery should do only database.
But when I look at the thread-dump all the queries are blocked by single
thread (even they are on different database).
Here are the connection urls of each db.
rtmch2db.driver.class.name = org.h2.Driver
rtmch2db1.url = jdbc:h2:mem:rtmch2db1;MVCC=TRUE;DB_CLOSE_DELAY=-1
rtmch2db2.url = jdbc:h2:mem:rtmch2db2;MVCC=TRUE;DB_CLOSE_DELAY=-1
rtmch2db3.url = jdbc:h2:mem:rtmch2db3;MVCC=TRUE;DB_CLOSE_DELAY=-1
rtmch2db4.url = jdbc:h2:mem:rtmch2db4;MVCC=TRUE;DB_CLOSE_DELAY=-1
rtmch2db5.url = jdbc:h2:mem:rtmch2db5;MVCC=TRUE;DB_CLOSE_DELAY=-1
rtmch2db6.url = jdbc:h2:mem:rtmch2db6;MVCC=TRUE;DB_CLOSE_DELAY=-1
I am using spring with h2. Here is the datasource configuration.
<bean id="h2DataSource1"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${rtmch2db.driver.class.name}"
/>
<property name="url" value="${rtmch2db1.url}" />
<property name="username" value="${rtmch2db.username}"/>
<property name="password" value=""/>
</bean>
<bean id="h2DataSource2"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${rtmch2db.driver.class.name}"
/>
<property name="url" value="${rtmch2db2.url}" />
<property name="username" value="${rtmch2db.username}"/>
<property name="password" value=""/>
</bean>
<bean id="h2DataSource3"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${rtmch2db.driver.class.name}"
/>
<property name="url" value="${rtmch2db3.url}" />
<property name="username" value="${rtmch2db.username}"/>
<property name="password" value=""/>
</bean>
<bean id="h2DataSource4"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${rtmch2db.driver.class.name}"
/>
<property name="url" value="${rtmch2db4.url}" />
<property name="username" value="${rtmch2db.username}"/>
<property name="password" value=""/>
</bean>
<bean id="h2DataSource5"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${rtmch2db.driver.class.name}"
/>
<property name="url" value="${rtmch2db5.url}" />
<property name="username" value="${rtmch2db.username}"/>
<property name="password" value=""/>
</bean>
<bean id="h2DataSource6"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${rtmch2db.driver.class.name}"
/>
<property name="url" value="${rtmch2db6.url}" />
<property name="username" value="${rtmch2db.username}"/>
<property name="password" value=""/>
</bean>
<jdbc:initialize-database data-source="h2DataSource1">
<jdbc:script location="classpath:current-values-schema.sql"/>
</jdbc:initialize-database>
<jdbc:initialize-database data-source="h2DataSource2">
<jdbc:script location="classpath:current-queue-depth-schema.sql"/>
</jdbc:initialize-database>
<jdbc:initialize-database data-source="h2DataSource3">
<jdbc:script location="classpath:current-agent-site-team-schema.sql"/>
</jdbc:initialize-database>
<jdbc:initialize-database data-source="h2DataSource4">
<jdbc:script location="classpath:current-agent-values-schema.sql"/>
</jdbc:initialize-database>
<jdbc:initialize-database data-source="h2DataSource5">
<jdbc:script location="classpath:current-call-skills-schema.sql"/>
</jdbc:initialize-database>
<jdbc:initialize-database data-source="h2DataSource6">
<jdbc:script location="classpath:current-agent-skills-schema.sql"/>
</jdbc:initialize-database>
when i dig into thread dump current running thread (query execution) sync
on
public ResultInterface executeQuery(int maxrows, boolean scrollable) {
startTime = 0;
Database database = session.getDatabase();
Object sync = database.isMultiThreaded() ? (Object) session :
(Object) database;
session.waitIfExclusiveModeEnabled();
* synchronized (sync) {*
* try {*
* database.checkPowerOff();*
* session.setCurrentCommand(this);*
* return query(maxrows);*
* } catch (DbException e) {*
* e.addSQL(sql);*
* database.exceptionThrown(e.getSQLException(), sql);*
* throw e;*
* } finally {*
* stop();*
* }*
* }*
}
H2 should do syncronization on database right? Can you please let me know
where I am doing wrong?
Thanks,
Suresh
On Sun, Apr 10, 2011 at 2:29 AM, Thomas Mueller <
[email protected]> wrote:
> Hi,
>
> > Can I create separate data base for each table? The tables are
> not
> > related to each other.
> > Can this help?
>
> Yes, I believe this would help.
>
> Regards,
> Thomas
>
> --
> 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.
>
>
--
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.