Jbuilder2005+jboss+oracle9i Environment Configuration Tutorial

Source: Internet
Author: User
Tags stmt zip jboss oracle database

Borland JBuilder is a very convenient Java IDE development tool, and JBoss is a good open source application server, Oracle 9i is a good enterprise-level database. Here's a description of the Java EE development environment for configuring JBuilder 2005, JBoss 4.0, and oracle9i in the Windows XP environment.

1. Install the SDK to the D:j2sdk1.4.2_06 method: Double-click the download J2sdk-1_4_2_06-windows-i586-p.exe file, select the installation directory for D:J2SDK1.4.2_06, other default can be.

2. Install JBoss by extracting the downloaded Jboss-4.0.1rc1.zip file into any directory, such as d:jboss4.0, which has a series of files and folders under this folder. The JBOSS will be installed in the d:jboss4.0 directory.

3, set the environment variable, under the WinXP method for, on the desktop right click on "My Computer", select Properties, then click "Advanced"-> "Environment variables" on the page that pops up, and then, under System variables on the page that pops up, tap New, and then in the pop-up window, "Enter the variable name (N)" Java_home, enter "D:j2sdk1.4.2_06" in the variable Value (V) column. Jboss_home value is: d:jboss4.0, add path: "d:j2sdk1.4.2_06in; d:jboss4.0in "

4, configure JBoss in JBuilder, select the Config servers of tools, then select jboss3+, select Enable server, specify home directory.

5. Configuring oracle9i data sources in JBoss and testing, Oracle becomes a very popular enterprise database with its stable and reliable operation. The first thing we need to do to configure Oracle on JBoss is to copy Oracle's JDBC driver to classpath. We copy this JDBC driver (Classes111.zip and Classes12.zip) to the Server/default/lib directory. In order to use Oracle's transactional data source we have to/docs/examples/jca/oracle-xa-ds. The XML is copied to the/server/default/deploy directory. If you are using something that is not a transactional data source, copy the/docs/examples/jca/oracle-ds.xml file to the/server/default/deploy directory.

Next, we need to modify the Oracle-ds.xml configuration file. The revised section reads as follows:

  

  

Oracleds

Jdbc:oracle:thin: @localhost: oradb

Oracle.jdbc.driver.OracleDriver

Hrms

Hrms

Org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter

  

  

Oracle9i

  

  

  

Here's how to run the JBoss Test connection database:

The steps are as follows: New Folder Db_test.war in "JBoss installation directory Serverdefaultdeploy", new index.jsp in Db_test.war, as follows:

<%@ page

Language= "Java"

Contenttype= "text/html; charset=gb2312 "

Pageencoding= "GBK"

%>

<%@ page import= "java.sql.*, Javax.sql.DataSource, Javax.naming.InitialContext"%>

  

Test JBoss Connection Oracle 9i Database

  

Test Oracle Database

<%

InitialContext CTX = new InitialContext ();

DataSource ds = (DataSource) ctx.lookup ("Java:/oracleds");

Connection conn = Ds.getconnection ();

Statement stmt = Conn.createstatement ();

ResultSet rs = stmt.executequery ("Select To_char (Sysdate,´yyyy-mm-dd hh24:mi:ss´) from DUAL");

while (Rs.next ()) {

Out.println (rs.getstring (1) + "
");

Out.println ("My name is Justinchen
");

}

Conn.close ();

%>

Create a new folder in Db_test.war Web-inf, which has two files Jboss-web.xml and web.xml, with jboss-web.xml content as follows:

  

  

And the Web.xml content is as follows:

  

  

"-//sun Microsystems, INC.//DTD Web application 2.3//en"

"Http://java.sun.com/dtd/web-app_2_3.dtd" >

  

Access to Http://localhost:8080/db_test, which indicates a normal connection to the database after success.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.