Dashboard > SakaiPedia > Database Setup in Sakai 2.0
  SakaiPedia Log In | Signup View a printable version of the current page.  
  Database Setup in Sakai 2.0
Added by Mark J. Norton, last edited by Ray Davis on Jun 11, 2005  (view change)
Labels: 
(None)

WARNING - Some of the information below is out of date. Until better documentation is available, please go to the source code and use "sakai2/demo/sakai.properties" as a model.


Here's how to change the demo (and any sakai2 installation) to use Oracle or MySql.

We have to override some database settings. We do this in sakai.properties.

sakai.properties is located in the sakai.home folder. By default, this is in tomcat/sakai/. Or you can set the jvm system property to point elsewhere with the -Dsakai.home= when you start up tomcat.

Wherever you establish sakai.home, you need to put a sakai.properties there. Demo ships with one in tomcat/sakai.

Every sakai.properties MUST HAVE these settings:

# sakai.properties - the demo edition

## Placeholder properties : the complete set must be defined here

# set the hibernate dialect (for shared datasource)
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect

#set the auto DDL feature
auto.ddl=true

This is due to a "bug" in Spring's placeholder system that we will address later.

Then you need some more stuff:

# set the hibernate dialect (for shared datasource), HSQLDB by default, mySql and Oracle examples
# NOTE: this is required, and must be in any sakai.properties file
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
#hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
#hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect

# set the shared datasource driver, HSQLDB by default, mySql and Oracle examples
driverClassName@javax.sql.DataSource=org.hsqldb.jdbcDriver
#driverClassName@javax.sql.DataSource=com.mysql.jdbc.Driver
#driverClassName@javax.sql.DataSource=oracle.jdbc.driver.OracleDriver

# set the shared datasource URL, HSQLDB in-memory by default, mySql and Oracle examples
url@javax.sql.DataSource=jdbc:hsqldb:.
#url@javax.sql.DataSource=jdbc:mysql://127.0.0.1:3306/sakai?useUnicode=true&characterEncoding=UTF-8
#url@javax.sql.DataSource=jdbc:oracle:thin:@monster.oracle.org:1521:db

And:

username@javax.sql.DataSource=
password@javax.sql.DataSource=

So... for a MySql, a sakai.properties would look like this:

auto.ddl=true
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
driverClassName@javax.sql.DataSource=com.mysql.jdbc.Driver
url@javax.sql.DataSource=jdbc:mysql://127.0.0.1:3306/sakai?useUnicode=true&characterEncoding=UTF-8
username@javax.sql.DataSource=whatever
password@javax.sql.DataSource=whichever

just set the url, username and password.

And... for Oracle, use this:

auto.ddl=true
hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect
driverClassName@javax.sql.DataSource=oracle.jdbc.driver.OracleDriver
url@javax.sql.DataSource=jdbc:oracle:thin:@monster.oracle.org:1521:db
username@javax.sql.DataSource=scott
password@javax.sql.DataSource=tiger

again, setting the url, username and password.

If this is your sakai.properties, and it's properly found at runtime in the sakai.home, then you will have connected to the database of choice. Everything in Sakai is using this setting.

  • Glenn Golden

I was setting up sakai 2.0.1 with a mySQL database (4.1.13a-nt) running on WinXP and couldn't get it working with the latest JDBC driver (mysql-connector-java-3.1.10-bin.jar). Once I replaced the driver with an earlier version (mysql-connector-java-3.0.16-ga-bin.jar) I got rid of the Exceptions (com.mysql.jdbc.Driver not found).

Site running on a free Atlassian Confluence Open Source Project License granted to Sakai Foundation. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators