At line 1 changed 1 line. |
TODO...Information on running Oracle with AppFuse. |
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 added 88 lines. |
!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>; |
}}} |
|
!!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.) |
|
<div class="note" style="margin: 10px">__NOTE:__ According to the [Oracle JDBC Driver README | http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_readme9201.html], classes12.jar is for JDK1.2 & 1.3, ojdbc14.jar is for JDK 1.4. The instructions here assume you will be using ojdbc14.jar, modify the instructions below accordingly if otherwise.</div> |
|
Next, in your {AppFuse home}/lib directory, add an "oracle" directory and place the ojdbc14.jar in it. |
|
|
!!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): |
|
{{{ |
database.jar=${lib.dir}/oracle/ojdbc14.jar |
database.type=oracle |
database.host=localhost |
#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) |
|
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect |
database.driver_class=oracle.jdbc.driver.OracleDriver |
database.url=jdbc:oracle:thin:@localhost:1521:mySID |
}}} |
|
You'll also need to add the "database.schema" property to build.xml - in the <dbunit> 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. |
</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: |
|
{{{ |
select username, country from app_user; |
}}} |
|
If everything is working correctly, you should see that the country value has changed for the profile that you edited. |
|