[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: DefaultDS - Replacing HSQL with Oracle

bpradhan do-not-reply at jboss.com
Fri Feb 6 04:32:18 EST 2009


Hi, Please refer chapter 14 in installation and getting started guide for Jboss 4.2.2/5.0. ( from jboss.org)

If you retain 'DefaultDS' name for oracle, ( you may prefer it as it does not require changing configuration of those services using database using DefaultDS)

For this you may have to remove hsql ds xml from deploy dir..and put oracle-ds-xml..

a) Yes, you will see many tables created by Jboss in your databse as 'DefaultDS' is used as data source in other Jboss servicess such as messaging, JAAS, etc...

b) You may create a simple database client test app as follows.. create a test.jsp with following contents..


  | <%@page contentType="text/html"
  | import="java.util.*,javax.naming.*,javax.sql.DataSource,java.sql.*"
  | %>
  | <%
  | DataSource ds = null;
  | Connection con = null;
  | PreparedStatement pr = null;
  | InitialContext ic;
  | try {
  | ic = new InitialContext();
  | ds = (DataSource)ic.lookup( "java:/DefaultDS" );
  | con = ds.getConnection();
  | pr = con.prepareStatement("SELECT col1, col2 FROM <your table name in oracle DB>"); // any test sql, or its variant
  | ResultSet rs = pr.executeQuery();
  | while (rs.next()) {
  | out.println("<br> " +rs.getString("col1") + " | " +rs.getString("col2"));
  | }
  | rs.close();
  | pr.close();
  | }catch(Exception e){
  | out.println("Exception thrown " +e);
  | }finally{
  | if(con != null){
  | con.close();
  | }
  | } %>
  | 
  | 

create a directory test.war in $JBOSS_HOME\server\{your svr confg such as default}\deploy\
Put this test.jsp under test.war

test the jsp at http://localhost:8080/test/test.jsp

hope this helps..

Cheers,
bpradhan

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207624#4207624

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207624



More information about the jboss-user mailing list