Sakai database property settings are stored in sakai.properties and placeholder.properties. Both files are located by default in tomcat/sakai
.
Every sakai.properties MUST HAVE these settings:
# sakai.properties ## 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
- set the vendor for legacy sql access
vendor@org.sakaiproject.service.framework.sql.SqlService=hsqldb
#vendor@org.sakaiproject.service.framework.sql.SqlService=mysql
#vendor@org.sakaiproject.service.framework.sql.SqlService=oracle
And:
username@javax.sql.DataSource=
password@javax.sql.DataSource=
So... for MySQL, a sakai.properties would look like this:
auto.ddl=true hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect vendor@org.sakaiproject.service.framework.sql.SqlService=mysql 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 vendor@org.sakaiproject.service.framework.sql.SqlService=oracle 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.