Difference between revisions of "Using OpenKM with other databases"
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | By default, OpenKM uses an embedded database called [http://hsqldb.org/ HSQLDB]. This database is integrated into JBoss and offers | + | By default, OpenKM uses an embedded database called [http://hsqldb.org/ HSQLDB]. This database is integrated into JBoss and offers good performance and low hardware requirements. But sometimes it is not enough for some users who need OpenKM to be deployed within their IT structure, which may be based on another database vendor. |
− | + | Starting with OpenKM 5, you can create the databases automatically by configuring the '''hibernate.dialect''' and '''hibernate.hbm2ddl''' properties in [[OpenKM.cfg]]. | |
<source lang="java"> | <source lang="java"> | ||
Line 8: | Line 8: | ||
</source> | </source> | ||
− | Once the tables are created, change the '''hibernate.hbm2ddl''' property from ''create'' to ''none''. If you want to see the table creation script, create, compile and run this piece of code: | + | Once the tables are created, change the '''hibernate.hbm2ddl''' property from ''create'' to ''none''. Also, a couple of new configuration properties are of interest: |
+ | |||
+ | <source lang="java"> | ||
+ | hibernate.show_sql=false | ||
+ | hibernate.statistics=true | ||
+ | </source> | ||
+ | |||
+ | With these properties you can configure if you want to see the SQL sentences generated by Hibernate, and enable Hibernate statistics. Only meaningful for development and fine tuning. | ||
+ | |||
+ | == Generating database script == | ||
+ | If you want to see the table creation script, create, compile and run this piece of code: | ||
<source lang="java"> | <source lang="java"> | ||
Line 23: | Line 33: | ||
se.setOutputFile("/path/to/schema.sql"); | se.setOutputFile("/path/to/schema.sql"); | ||
se.setFormat(true); | se.setFormat(true); | ||
− | se.create(false, false); | + | se.create(false, false); |
} | } | ||
} | } | ||
</source> | </source> | ||
− | {{Warning|This configuration property should be set before the database creation. Once the database has been initialized don't modify it because can damage your installation. If your OpenKM installation has been already configured with another database (default one is an embedded one called | + | {{Warning|This configuration property should be set before the database creation. Once the database has been initialized don't modify it because you can damage your installation. If your OpenKM installation has been already configured with another database (default one is an embedded one called HSQLDB) you can't switch to another database simply by changing this property.}} |
Here we will discuss the changes needed to run OpenKM with these databases: | Here we will discuss the changes needed to run OpenKM with these databases: | ||
− | * [[MySQL]] [[File:Padlock.gif]] | + | ** [[MySQL]] |
− | * [[PostgreSQL]] [[File:Padlock.gif]] | + | *** [[MySQL-OpenKM 6.2 | OpenKM 6.2]] |
− | * [[ | + | *** [[MySQL-OpenKM 5.0 | OpenKM 5.0]] |
− | * [[ | + | *** [[MySQL-OpenKM 4.1 | OpenKM 4.1]] |
+ | ** [[PostgreSQL]] [[File:Padlock.gif]] | ||
+ | *** [[PostgreSQL-OpenKM 6.2 | OpenKM 6.2]] [[File:Padlock.gif]] | ||
+ | *** [[PostgreSQL-OpenKM 5.0 | OpenKM 5.0]] [[File:Padlock.gif]] | ||
+ | *** [[PostgreSQL-OpenKM 4.1 | OpenKM 4.1]] [[File:Padlock.gif]] | ||
+ | ** [[Other DBMS]] | ||
+ | |||
+ | {{Note|You can find the DDL SQL sentences for table creation for several databases at [[File:Jbpm-ddl-3.3.1.zip]].}} | ||
+ | |||
+ | See also: | ||
+ | * [http://jandrewthompson.blogspot.com/2009/10/how-to-generate-ddl-scripts-from.html How To Generate DDL Scripts from Hibernate] | ||
[[Category: Installation Guide]] | [[Category: Installation Guide]] |
Latest revision as of 18:41, 24 October 2012
By default, OpenKM uses an embedded database called HSQLDB. This database is integrated into JBoss and offers good performance and low hardware requirements. But sometimes it is not enough for some users who need OpenKM to be deployed within their IT structure, which may be based on another database vendor.
Starting with OpenKM 5, you can create the databases automatically by configuring the hibernate.dialect and hibernate.hbm2ddl properties in OpenKM.cfg.
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.hbm2ddl=create
Once the tables are created, change the hibernate.hbm2ddl property from create to none. Also, a couple of new configuration properties are of interest:
hibernate.show_sql=false
hibernate.statistics=true
With these properties you can configure if you want to see the SQL sentences generated by Hibernate, and enable Hibernate statistics. Only meaningful for development and fine tuning.
Generating database script
If you want to see the table creation script, create, compile and run this piece of code:
import java.io.File;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class Test {
public static void main(String[] args) throws Exception {
Configuration cfg = new Configuration();
cfg.configure(new File("/path/to/hibernate.cfg.xml"));
SchemaExport se = new SchemaExport(cfg);
se.setOutputFile("/path/to/schema.sql");
se.setFormat(true);
se.create(false, false);
}
}
Here we will discuss the changes needed to run OpenKM with these databases:
You can find the DDL SQL sentences for table creation for several databases at File:Jbpm-ddl-3.3.1.zip. |
See also: