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 1 line. |
# 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> |
!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. |
|
At line 5 changed 3 lines. |
CREATE USER APPFUSE IDENTIFIED BY APPFUSE; |
GRANT CONNECT TO APPFUSE; |
GRANT RESOURCE TO APPFUSE; |
CREATE USER <database-schema-owner> IDENTIFIED BY <password>; |
GRANT CONNECT TO <database-schema-owner>; |
GRANT RESOURCE TO <database-schema-owner>; |
At line 9 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 13 changed 11 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 29 added 7 lines. |
|
!!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 28 removed 1 line. |
database.name=appfuse |
At line 30 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 35 changed 1 line. |
hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect |
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect |
At line 37 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 42 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> |
You'll also need to add the "database.schema" property to build.xml - in the <dbunit> tasks. For example: |
At line 44 changed 1 line. |
# Run "ant new -Dapp.name=myappname -Ddb.name=appfuse" as normal to generate your new web application directory. |
{{{ |
<dbunit driver="${database.driver_class}" schema="${database.schema}" |
supportBatchStatement="false" url="${database.url}" |
userid="${database.username}" password="${database.password}"> |
}}} |
At line 46 changed 1 line. |
# 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. |
<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> |
At line 48 changed 1 line. |
# Run "ant setup" within your new web app directory to compile and deploy your new application on Tomcat. |
<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> |
At line 50 changed 1 line. |
# Start tomcat and bring up the application: http://localhost:8080/myappname |
<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> |
At line 52 changed 1 line. |
<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> |
!!Generate Application [#4] |
At line 54 changed 1 line. |
# 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: |
Run __ant new -Dapp.name={{myappname}} -Ddb.name={{mydbname}}__ as usual to generate the new web application directory. |
At line 68 added 17 lines. |
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. |
</div> |
|
!!Test Database Access [#6] |
|
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: |
|