Recent Changes - Search:

ProReports

edit SideBar

Respect my work!
If you are using commercially ProReports pay donate:

or

        BTC: 

1MTFbBSKrocPK7G6GKfG8RoTw5N57WnnNa

If you have paid donate send me e-mail with Your data or transaction number to receive an access code to articles with limited access.

H2 database - several drivers

Download

ProReports system uses the H2 database as an internal database. Due to the fact that the system uses an older version than the current one, when trying to access the user's H2 database, there may be a conflict between version of driver and database engine. Therefore, I have prepared driver version for the lastest version of H2 database. To access database with this driver, you need to prepare the datasource as JNDI.

Note!

Datasource JDBC not work correct because in this case internal driver (older) for database H2 is used.

JNDI definition to H2 database

  • in file <proreports_dir>/etc/jetty.xml at end of file add:
<New id="prefixDB" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/prefixDB</Arg>
<Arg>
   <New class="prorepo.org.h2.jdbcx.JdbcDataSource">
      <Set name="URL">jdbc:h2:tcp://ADDRESSIP:9092/DATABASE</Set>
      <Set name="LoginTimeout">10000</Set>
      <Set name="user">USER</Set>
      <Set name="password">PASSWORD</Set>
   </New>
</Arg>
</New>

for example:

<New id="myh2DB" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/myh2DB</Arg>
<Arg>
   <New class="prorepo.org.h2.jdbcx.JdbcDataSource">
      <Set name="URL">jdbc:h2:tcp://192.168.10.20:9092/base</Set>
      <Set name="LoginTimeout">10000</Set>
      <Set name="user">sa</Set>
      <Set name="password">sasa</Set>
   </New>
</Arg>
</New>
  • in file <proreports_dir>/webapps-plus/rep/WEB-INF/web.xml add:
 <resource-ref>   
          <res-ref-name>jdbc/prefixDB</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
          <res-sharing-scope>Shareable</res-sharing-scope> 
   </resource-ref>

for example:

 <resource-ref>   
          <res-ref-name>jdbc/myh2DB</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
          <res-sharing-scope>Shareable</res-sharing-scope> 
   </resource-ref>
  • and add datasource as JNDI (how do that see here).

How prepare own file with driver for own version of H2 database

Note!

This method can be used if you have to use several different versions of JDBC drivers.

  • create directory jarjar, for example c:\jarjar
  • create directory lib, for example c:\jarjar\lib
  • download file jarjar-1.4.zip and unzip in directory jarjar
  • create file jarjar.conf in direcotory jarjar with content:
rule org.h2.** prefix.org.h2.@1

for example:

rule org.h2.** prorepo.org.h2.@1
  • download correct file h2*.jar from site of project and copy file to jarjar\lib directory
  • create file jarjar.bat in direcotry jarjar
java -jar jarjar-1.4.jar process jarjar.conf lib/<file h2*jar> lib/prefix<file h2*.jar>

for example:

java -jar jarjar-1.4.jar process jarjar.conf lib/h2-1.4.200.jar lib/prorepo.h2-1.4.200.jar
  • run file jarjar.bat (in directory jarjar\lib will be created file prefix<file h2*.jar>)
  • copy file prefix<file h2*.jar> to <proreports_dir>javalib/jdbc


This page may have a more recent version on pmwiki.org: PmWiki:H2, and a talk page: PmWiki:H2-Talk.

Edit - History - Print - Recent Changes - Search
Page last modified on August 04, 2021, at 04:57 PM EST