Edit avaje.properties


With Ebean you can use more than one DataSource. This means that you need to configure each DataSource and also tell Ebean which one is the 'default' DataSource (via the datasource.default property).

Built in DataSource:

To use the built in DataSource set properties similar to the following. Note that in the examples (part of download) the avaje.properties includes settings for an Oracle, MySql and MSSQLServer 2005 DataSources.

# use default 

# The name of the Default DataSource 
# (as you can have more than one)

# connection properties
#datasource.TestDB.heartbeatsql=select count(*) from dual
JNDI DataSource: (Since 0.9.2)

To use a JNDI DataSource you need to set ebean.datasource.factory to jndi, and datasource.default as the JNDI DataSource name. You can additionally override ebean.datasource.jndi.prefix which defaults to java:comp/env/jdbc/.

# use JNDI 

# The name of the JNDI DataSource

# Override the JNDI prefix if required

Note that when running in Standalone mode you often will not have a JNDI DataSource (usually provided by the Servlet Container). You may wish to also specify a DataSource using the Ebean default mechanism.

Custom DataSource Factory:

You can implement your own DataSourceFactory. Its job is to provide the DataSource given the name.

Create a class that implements com.avaje.ebean.server.core.DataSourceFactory. Specify its use with the ebean.datasource.factory property.

# use custom 

Log Configuration

There are 2 types of log files. The transaction logs and the 'main' log.

Location of log files


The log.directory property needs to be set. It determines where the 'main' log and transaction logs are put.

In general I think its good to put these with the other server logs but that is my preference. In the example above catalina.base is a Java System property set by Tomcat.

Use Log4j

If you want to use Log4j then you can set these settings. Note that this is only for the 'main' log and not the transaction logs. [If you are using this and are unsatisfied then let me know - thanks]

# use Log4j
log4j.properties=point to the log4j properties file
Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements