Deployment Seam Application against Oracle 10g database to Jboss 4.0.5
utilizing Seam Plugin for NetBeans 5.5.1 on CentOS 5.0
To tune Jboss 4.0.5 instance as advised in [1] and make it connects to Oracle Server, perform the following steps on the JBoss Application Server:
Download the JDBC driver for Oracle 10g Release 2 located at:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
For the Oracle JDBC driver with JDK 1.4 and 1.5, use the ojdbc14.jar file.
Copy the JDBC driver to the JBoss environment by entering the following:
# cp ojdbc14.jar $JBOSS_HOME/server/default/lib
Create a file named $JBOSS_HOME/server/default/deploy/oracle-ds.xml and add the following contents:
<datasources>
<local-tx-datasource>
<jndi-name>oracleDS</jndi-name>
<connection-url>jdbc:oracle:thin:@IP_OR_HOSTNAME_OF _ORACLE_DB_ SERVER:1521:ORACLE_SID
</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>USERNAME</user-name>
<password>PASSWORD</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
Testing the Oracle Database Connectivity
Test the connectivity between JBoss and Oracle by performing the following steps on the JBoss Application Server:
Create a JSP file named $JBOSS_HOME/server/default/deploy/jmx-console.war/oracleTest.jsp and add the following contents:
<%@page contentType="text/html" import="java.net.*,java.util.*,org.jboss.jmx.adaptor.model.*,
java.io.*,java.sql.*,javax.sql.*,javax.naming.*"%>
<html>
<head>
<title>JBoss->Oracle Test </title>
<link rel="stylesheet" href="style_master.css" type="text/css">
<meta http-equiv="cache-control" content="no-cache">
</head>
<body>
<%
InitialContext ctx = new InitialContext();
DatabaseMetaData dm = null;
DataSource ds = (DataSource)
ctx.lookup("java:/oracleDS");
Connection conn = null;
Statement stmt = null;
try {
conn = ds.getConnection();
dm =conn.getMetaData();
out.println("Connected to-> database version "+dm.getDatabaseProductVersion());
}catch (Exception sqlex) {
out.println(sqlex.getMessage());
}finally{
conn.close();
}
%>
</body>
</html>