Edit avaje.properties

DataSource

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 
ebean.datasource.factory=default

# The name of the Default DataSource 
# (as you can have more than one)
datasource.default=TestDB

# connection properties
datasource.TestDB.username=test
datasource.TestDB.password=test
datasource.TestDB.databaseUrl=jdbc:mysql://127.0.0.1:3306/zsite?dynamicCalendars=false
datasource.TestDB.databaseDriver=com.mysql.jdbc.Driver
datasource.TestDB.minConnections=1
datasource.TestDB.maxConnections=25
#datasource.TestDB.heartbeatsql=select count(*) from dual
datasource.TestDB.isolationlevel=read_committed
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 
ebean.datasource.factory=jndi

# The name of the JNDI DataSource
datasource.default=TestDB

# Override the JNDI prefix if required
#ebean.datasource.jndi.prefix=java:comp/env/jdbc/

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 
ebean.datasource.factory=mypackage.MyDataSourceFactory

Log Configuration

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

Location of log files

 
log.directory=${catalina.base}/logs

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
log.writer=com.avaje.lib.Log4jLogger
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
woResponse