ofbiz9框架 + oracle 11g整合开发html
转自 http://ajava.org/course/open/14640.htmljava
转自 http://job6688.spaces.live.com/blog/cns!FA3F6195E8CF95F7!236.entrymysql
核心提示:ofbiz默认的数据库为derby,这个固然不能在生产环境中使用,并且也不方便调试和管理。虽然ofbiz也支持不少的开源数据库,例如 mysql等,可是咱们这里仍是使用主流的数据库系统oracle 11g.详细的操做以下 1.更新JDBC驱动,将oracle最新的jdbc驱动copy到${ofbizweb
ofbiz默认的数据库为derby,这个固然不能在生产环境中使用,并且也不方便调试和管理。虽然ofbiz也支持不少的开源数据库,例如mysql等,可是咱们这里仍是使用主流的数据库系统oracle 11g.详细的操做以下
1.更新JDBC驱动,将oracle最新的jdbc驱动copy到${ofbiz install dir}/framework/entity/lib/jdbc 目录下。
2.设置实体引擎( Entity Engine)的缺省数据库为oracle.在修改 ${ofbiz install dir}/framework/entity/config/entityengine.xml文件中修改配置:
a.修改数据库链接参数:sql
- <datasource name="localoracle"
- helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
- schema-name="ofbiz" 你的数据库schema名称
- field-type-name="oracle"
- check-on-start="true"
- add-missing-on-start="true"
- alias-view-columns="false"
- join-style="ansi">
- <read-data reader-name="seed"/>
- <read-data reader-name="seed-initial"/>
- <read-data reader-name="demo"/>
- <read-data reader-name="ext"/>
- <inline-jdbc
- jdbc-driver="oracle.jdbc.driver.OracleDriver"
- jdbc-uri="jdbc:oracle:thin:@192.168.1.154:1521:ofbiz" ofbiz为你的数据库SID
- jdbc-username="ofbiz" 用户名
- jdbc-password="ofbiz" 密码
- pool-minsize="2"
- pool-maxsize="250"/>
- /datasource>
b. 修改实体引擎的数据库缺省配置以下:(将datasource-name的值设置为“localoracle”)数据库
- <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
- <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
- <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
- delegator>
- <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">
- <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
- <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
- delegator>
-
-
- <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
- <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
- <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
- delegator>
- <delegator name="other" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
- <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
- delegator>
3.补充:在进行以上配置时,请确保你已经存在ofbiz的数据库,实例,用户等都已建立好。
4. 初始化数据和导入:
ofbiz$ java -jar ofbiz.jar -install
经过以上命令便可进行数据库的初始化和初始数据的导入,这里包括了ofbiz自带的例子,应用的全部的数据表和初始化数据
5.问题:
在使用oracle数据库时,当前的版本可能会碰到ORA-01843:无效的月份的问题 服务器
以sys用户登录并建立Trigger:session
- create or replace TRIGGER ON_CONNECT AFTER LOGON ON DATABASE
- DECLARE
- guser varchar2(30);
- begin
- SELECT sys_context('USERENV','SESSION_USER') into guser FROM dual;
- if (guser='ofbiz' or guser='OFBIZ') THEN
- EXECUTE IMMEDIATE 'alter session set nls_timestamp_format = ''YYYY-MM-DD HH24:MI:SS.FF''';
- end if;
- end;
注意对登录用户名的判断必须大小写都要考虑.oracle
另:ofbiz用户不能拥有dba的权限,同时ofbiz用户比须要有UNLIMITED TABLESPACE的权限,不然在建立数据表的时候会报“数据库空间不足”的错误,致使没法建立表。
6.参考:
http://blog.csdn.net/blieveme/archive/2007/10/16/1826604.aspx
http://docs.ofbiz.org/display/~jacopoc/OFBiz+and+Oracle框架
ajava.org补充:OFBiz是一个很是著名的开源项目,提供了建立基于最新J2EE/XML规范和技术标准,构建大中型企业级、跨平台、跨数据库、跨应用服务器的多层、分布式电子商务类WEB应用系统的框架。 OFBiz最主要的特色是OFBiz提供了一整套的开发基于Java的web应用程序的组件和工具。包括实体引擎, 服务引擎, 消息引擎, 工做流引擎, 规则引擎等。