配置 Gatein 為Oracle連接 |
| 發(fā)布時(shí)間: 2012/9/17 17:00:00 |
|
主要環(huán)境: Orace 10G Gatein3.1.0-GA 引用一下Gatein 官方使用手冊(cè)上的原文并簡(jiǎn)單反譯和注解一下大概意思:- 2.1. Database Configuration When you change the database configuration for the first time, GateIn will automatically generate the proper schema (assuming that the database user has the appropriate permissions). GateIn 3.1 assumes the default encoding for your database is latin1. You may need to change this parameter for your database in order for GateIn 3.1 to work properly. 概述: 主要是說Gatein依賴兩個(gè)數(shù)據(jù)庫(kù) 一個(gè)是用來做身份認(rèn)證的,是用Hibernate的。 另一個(gè)用來支持JCR的,用JDBC API 兩個(gè)都可以支持當(dāng)前任何已存在的數(shù)庫(kù)。 在你第一次改變數(shù)據(jù)庫(kù)配置后,Gatein將會(huì)自動(dòng)的生成schema(注解:數(shù)據(jù)庫(kù)的方案,就是表,視圖等)(你的數(shù)據(jù)庫(kù)用戶要有這些權(quán)限) GateIn3.1假定你的數(shù)據(jù)庫(kù)編碼方式為latin1,你可能需要改變你的數(shù)據(jù)庫(kù)的編碼方式來讓Gate3.1正常工作 (注解:latin1 就是ISO8859-1編碼,這個(gè)好像是mySql常用的編碼方式,在我建立Oracle數(shù)據(jù)庫(kù)時(shí)并沒有這個(gè)編碼方式,我用的是UTF-8,這個(gè)是寬字符集,應(yīng)該是兼容的,反正到現(xiàn)在還沒發(fā)現(xiàn)有問題)2.1.2. Configuring the database for JCR $JBOSS_HOME/server/default/conf/gatein/configuration.propertiesFor Tomcat, the file is located at $TOMCAT_HOME/gatein/conf/configuration.propertiesAnd edit the values of driver, url, username and password with the values for your JDBC connection (please, refer to your database JDBC driver documentation).
In the case of HSQL the databases are created automatically. For any other database you will need to create a database named jdbcjcr_portal (and "jdbcjcr_sample-portal" if you have gatein-sample-portal.ear in $JBOSS_HOME/server/default/deploy - note that some databases don't accept '-' in the database name, so you may have to remove $JBOSS_HOME/server/default/deploy/gatein-sample-portal.ear) Make sure the user has rights to create tables on jdbcjcr_portal, and to update them as they will be automatically created during the first startup . Also add your database's JDBC driver into the classpath - you can put it in $JBOSS_HOME/server/default/lib (or $TOMCAT_HOME/lib, if you are running on Tomcat) MySQL example: Let's configure our JCR to store data in MySQL. Let's pretend we have a user named "gateinuser" with a password "gateinpassword". We would create a database "mygateindb_portal" (remember that _portal is required), and assign our user the rights to create tables. Then we need to add MySQL's JDBC driver to the classpath, and finally edit gatein.ear/02portal.war/WEB-INF/conf/jcr/jcr-configuration to contain the following: gatein.jcr.datasource.driver=com.mysql.jdbc.Driver ....略去說它自已的默認(rèn)配置方式,重點(diǎn)在下一段里..... 要確保你的數(shù)據(jù)庫(kù)用戶有建表的權(quán)限。要把你的數(shù)據(jù)庫(kù)驅(qū)動(dòng)考到$JBOSS_HOME/server/default/lib (你用Tomcat的話是$TOMCAT_HOME/lib)給出了一個(gè)mysql 的例子:gatein.jcr.datasource.driver=com.mysql.jdbc.Driver $JBOSS_HOME/server/default/conf/gatein/configuration.propertiesFor Tomcat, the file is located at $TOMCAT_HOME/gatein/conf/configuration.propertiesYou will find the same kind of configuration as in jcr-configuration.xml: gatein.idm.datasource.driver=org.hsqldb.jdbcDriver 看完上面的也就基本可以弄好了。多說一點(diǎn),我對(duì)Oracle不是很了解,oracle的sid是不可以有“_“的,但是全局?jǐn)?shù)據(jù)庫(kù)名可以有,但是連接url中的部分還是要寫sid的,寫數(shù)據(jù)庫(kù)名是不行了,有了解oracle的請(qǐng)指點(diǎn)一下。
本文出自:億恩科技【www.cmtents.com】 服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |
京公網(wǎng)安備41019702002023號(hào)