Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
AppFuseSupport
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh
IntegratingJBPMIntoA...
StrutsResumeSupport




JSPWiki v2.2.33

[RSS]


Hide Menu

RunningOnOracle


Difference between version 50 and version 21:

At line 1 changed 1 line.
The following instructions explain how to configure AppFuse so that the applications it generates will work with an Oracle database.
The following instructions describe the steps needed to configure AppFuse so that the applications it generates will work with an Oracle database.
At line 3 changed 4 lines.
# Create the Oracle Database schema account that will hold the default application tables. This can be done by your Oracle DBA. (You can choose a different user/schema name and password, just modify the subsequent instructions accordingly.)<div> {{{
CREATE USER APPFUSE IDENTIFIED BY APPFUSE;
GRANT CONNECT TO APPFUSE;
GRANT RESOURCE TO APPFUSE;
!Table of Contents
* [1] Create Database Schema
* [2] Setup JDBC Driver
* [3] Edit build.properties in the main AppFuse Directory
* [4] Generate Application
* [5] Deploy Application
* [6] Test Database Access
!!Create Database Schema [#1]
Create the Oracle Database schema account that will hold your application's tables. This value should correspond to the {{-Ddb.name}} you use when running the __ant new__ task.
{{{
CREATE USER <database-schema-owner> IDENTIFIED BY <password>;
GRANT CONNECT TO <database-schema-owner>;
GRANT RESOURCE TO <database-schema-owner>;
At line 8 removed 1 line.
# Obtain the [Oracle JDBC driver|http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html] appropriate for your database and JDK version. (Oracle's license agreement will be shown just be downloading, make sure you read and understand it.)
At line 21 added 4 lines.
!!Setup JDBC Driver [#2]
Obtain the [Oracle JDBC driver|http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html] appropriate for your database and JDK version. (Oracle's license agreement will be shown just be downloading, make sure you read and understand it.)
At line 12 changed 4 lines.
# In your {AppFuse home}/lib directory, add an "oracle" directory and place the ojdbc14.jar in it.
# Next, the build.properties file needs to be updated to switch from a MySQL to an Oracle database. This can be done in two ways:
* If most of your work is in Oracle, update the build.properties file in the AppFuse distribution. Most of its values will carry over to the build.properties file created within each app generated by AppFuse, so only a minor amount of editing of that second file will be necessary.
* If most of your work is not in Oracle, you can ignore the build.properties file in the AppFuse distribution, and just edit the build.properties in the directory of the web app generated by AppFuse.<div> Whether you edit one or both files, here is a idea of what the database entries should look like for Oracle (modify the various fields as appropriate for your system):</div>
Next, in your {AppFuse home}/lib directory, add an "oracle" directory and place the ojdbc14.jar in it.
At line 17 changed 1 line.
<div style="margin: 10px">
!!Edit build.properties in the main AppFuse Directory [#3]
Next, the build.properties file needs to be updated to use an Oracle (instead of the default MySQL) database.
Here is a idea of what the database entries should look like for Oracle (modify the various fields as appropriate for your system):
At line 20 removed 1 line.
At line 22 removed 1 line.
database.name=appfuse
At line 24 changed 4 lines.
#database URL for creating other databases (doesn't work with pgsql)
#database.admin.url=jdbc:${database.type}://${database.host}/template1
database.admin.username=appfuse
database.admin.password=appfuse
#use the database schema owner and password created in step #1 above here
database.username=username
database.password=password
database.schema=schemaname (case sensitive using 10g)
At line 29 changed 1 line.
hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
At line 31 changed 3 lines.
database.url=jdbc:oracle:thin:@localhost:1521:myDB
database.username=appfuse
database.password=appfuse
database.url=jdbc:oracle:thin:@localhost:1521:mySID
At line 49 added 30 lines.
You'll also need to add the "database.schema" property to build.xml - in the &lt;dbunit&gt; tasks. For example:
{{{
<dbunit driver="${database.driver_class}" schema="${database.schema}"
supportBatchStatement="false" url="${database.url}"
userid="${database.username}" password="${database.password}">
}}}
<div class="note" style="margin: 10px; background-color: #fcc">__WARNING:__ Avoid the use of "appfuse" as values for any of the parameters here. They may end up getting modified when you run the "ant new" task below.</div>
<div class="note" style="margin: 10px">__NOTE:__ In the listings above, {{database.host}} should refer to the machine the Oracle database is running on. Also, the "mySID" at the end of the {{database.url}} value should refer to the SERVICE_NAME within the tnsnames.ora database file on the database server machine.</div>
<div class="note" style="margin: 10px">__NOTE:__ There is also a {{database.name}} parameter available, but you should only add it to {{build.properties}} if you want to use a different database name than provided in the {{-Ddb.name}} parameter when you ran the __ant new__ task.</div>
!!Generate Application [#4]
Run __ant new -Dapp.name={{myappname}} -Ddb.name={{mydbname}}__ as usual to generate the new web application directory.
For {{mydbname}}, use the schema owner name you created in Step #1 above.
!!Deploy Application [#5]
Run "ant setup" within your new web app directory to compile and deploy your new application on Tomcat.
Next, Start Tomcat and bring up the application: http://localhost:8080/myappname
<div class="note" style="margin: 10px">
__NOTE:__ The Oracle database server may be configured to occupy port 8080 with its own servlet container, which you may find very difficult to disable. This can cause port conflicts if you are running Tomcat on the same machine. If this problem occurs, it may be easiest to shut down the Oracle database, start Tomcat (so it will occupy port 8080), and then restart Oracle.
At line 37 changed 1 line.
<div class="note" style="margin: 10px">__NOTE:__ In the listings above, database.host should refer to the machine the Oracle database is running on. Also, database.url's "myDB" at the end should refer to the SERVICE_NAME within the tnsnames.ora database file on the database server machine.</div>
!!Test Database Access [#6]
At line 39 changed 6 lines.
# Run "ant new -Dapp.name=myappname -Ddb.name=appfuse" as normal to generate your new web application directory.
# Reconfigure the build.properties file in the new "myappname" directory, following the instructions above. You will either need to update a few of the elements or all of them, depending on whether or not you decided to modify the main build.properties in the AppFuse distribution.
# Run "ant setup" within your new web app directory to compile and deploy your new application on Tomcat.
# Start tomcat and bring up the application: http://localhost:8080/myappname<div class="note" style="margin: 10px">__NOTE:__ The Oracle database server may be configured to occupy port 8080 with its own servlet container. This may cause port conflicts if you are running Tomcat on the same machine. It is very difficult to turn off the Oracle container (I was not successful in doing so.) If you run into this problem, you may wish to shut off the Oracle instance, start Tomcat (so it will occupy port 8080), and then restart the Oracle database.</div>
# To test that database accesses are working properly, edit one of the profiles within the sample application and change the country listed. Then, within Oracle SQL*Plus, log in as "appfuse" user and issue this command:
<div style="margin: 10px">
To test that database accesses are working properly, edit one of the profiles within the sample application and change the country listed. Then, within Oracle SQL*Plus, log in as the schema owner and issue this command:
At line 48 changed 1 line.
</div>

Back to RunningOnOracle, or to the Page History.