Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

On This Pagethis page:

Table of Contents
maxLevel12

Configuration Steps

1)  Copy the JDBC driver appropriate for your database into <frevvo-home>\tomcat\webapps\database\WEB-INF\lib

...

2)  If you did have to copy a JDBC driver into lib you must then Restart frevvo , Double click <frevvo-home>\stop-frevvo. Wait until frevvo stops stops. Then Double click <frevvo-home>\start-frevvo

...

If frevvo
Code Block
<Parameter name="frevvo.connectors.database.configuration" value="c:/frevvo/dbconfig/configuration.xml" override="false"/>
Note

Be sure to add it OUTSIDE of the manager tags in the file. Also, verify that your path to the configuration file is correct. Here is an example of how the file should look after editing:


Code Block
<Context swallowOutput="true" unloadDelay="40000">
           <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false">
                         <Store className="org.apache.catalina.session.FileStore"/>
           </Manager>
         <Parameter name="frevvo.connectors.database.configuration" value="C:/frevvo/dbconfig/configuration.xml" override="false"/>
</Context>

 

Note

If is running, when you edit and save this change to context.xml.default, frevvo should pickup this change within a couple seconds. If it doesn't, then stop and restart frevvo by: Double click <frevvo-home>\stop-frevvo. Wait for it to stop. Then double click <frevvo-home>\start-frevvo

Currently you MUST restart frevvo after moving the configuration file location. If you don't restart frevvo the connector will return a blank page rather than data and the frevvo- tomcat log will show an NPE error.

Define the Data Source

The frevvo database The  database connector needs to know:

  • the path to your database
  • a username to login to your database
  • a password for this username
  • which JDBC driver your database requires.

...

Code Block
<resource-def>
    <url>YOUR database Url HERE</url>   
    <driver>YOUR driver HERE</driver>
    <user>YOUR database user HERE</user>
    <password>YOUR password HERE</password>
</resource-def>

The <resource-def> defines the database connection inside the database connector itself.

Note

Under most operating systems the database connector will automatically reload the configuration.xml as soon as you edit and save changes, without the need to restart tomcat or the database connector itself. However under Mac OS auto reload does not work. To ensure that the change is reflected restart tomcat manually via the stop/start frevvo scripts.scripts.

Configuring a <resource-ref>

There is an alternate approach that defines the database connection in the application container (Tomcat if you are using the frevvo-tomcat bundle) instead of inside the database connector. To use this approach:

  1. Edit <frevvo-home>\tomcat\conf\Catalina\localhost\context.xml.default.
  2. Define a <resource> as shown below.
  3. Replace the <resource-def> element shown above in configuration.xml with a <resource-ref> element as shown below.

The XML samples below assume a MySql database driver. You will need to replace this sample values to match your database type.

This is the format of the <resource> element in context.xml.default.

Code Block
<Resource name="jdbc/mystore_ds" 
	   	  auth="Container" 
	   	  factory="org.apache.commons.dbcp.BasicDataSourceFactory"             
	      driverClassName="com.mysql.jdbc.Driver"
	      username="YOUR database user HERE"
	      password="YOUR database password HERE"
	      type="javax.sql.DataSource"
          url="jdbc:mysql://localhost/mystore?autoconnect=true"/> 

This is the format of the <resource-ref> element in configuration.xml.

Code Block
<resource-ref>
    <description>MySQL Customers</description>
    <res-ref-name>jdbc/mystore_ds</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

mySQL example

A mySql database named "test" running on localhost on the default port when the login for user "root" requires no password:

...

Code Block
<resource-def>
    <url>jdbc:as400://170.254.98.250:8888;date separator=-</url>       
    <driver>com.ibm.as400.access.AS400JDBCDriver</driver>
    <user>yourUser</user>
    <password>yourPassword</password>
</resource-def>

Oracle 11g

Here is an example that connects to an Oracle 11g driver.

Code Block
<resource-def>
    <url>jdbc:oracle:thin:@localhost:1521:ServiceName</url>                  
    <driver>oracle.jdbc.driver.OracleDriver</driver>
    <user>yourUser</user>
    <password>yourPassword</password>
    <validationQuery>select 1 from dual</validationQuery>
<resource-def>