JBoss MS SQL Server Configuration Guide
(Note: This article is an article in 2001. At that time, I was published on the China-Pub website. I got 460 currency values. I exchanged a << TCP / IP detailed explanation >> (first volume). However, go now The China-Pub site is already difficult to find the trace of this article. Although the article is over, it is always its own labor results, put it in your own blog, and will not cause the reader's condemnation)
Introduction
This article provides a detailed and easy-to-understand guidance to quickly master the use of Microsoft SQL Server Relational Database Management System (RDBMS) and JBoss J2EE Application Server Suite to develop, publish and run the basic knowledge of enterprise Java applications.
JBoss is a designated J2EE application server kit with a leading-ended open source. The kit includes JBossServer EJB v1.1 Container and server, JBossMQ JMS 1.0 implemetation, JBossNS JNDI implemetation, JBossCMP advanced O / R mapper and JDBC data object storage implemetation and JAAS-based JBossSX security frameeork. All JBoss applications are 100% pure Java applications.
Microsoft SQL Server is a robust high-performance and high security relational database platform. It is a Windows application running on Windows 95, 98, ME, NT, and 2000 platforms. It also has the version under the Windows CE platform, but I want you to use this version with JBoss?
A high-performance open source 100% Java J2EE application server JBoss suite and high-speed Microsoft SQL Server Rdbms can provide you with a J2EE development and publishing environment under a Windows platform, compared to J2EE under other Windows platforms. Application Suites and RDBMS schemes are excellent in performance, high return (ROI), greatly reduced product listing time (RTTM).
First, you need to get a JBoss software from the JBoss website. All JBoss product information and how to get JBoss software can be found in JBoss FAQ or in the JBoss site. The remainder of this article contains the following: 1. Install the JDBC driver for MS SQL Server 2. Configure JBoss to use the JDBC driver 3. Specify the MS SQL Server Data Type for CMP 4. Problem Solution Need to pay attention to the JBoss application server kit and MS SQL Server is flourishing. Their versions are issued, revised, and add new features. This means that some of this article is out of your JBoss or MS SQL Server. This situation is easier if you use the latest JBoss CVS version or development or MS SQL Server Beta.
Install the JDBC driver
Before you can use Microsoft SQL Server with JBoss (or all other Java applications), you must have a JDBC driver before you use Microsoft SQL Server. Some existing Microsoft SQL Server JDBC drivers are now listed below. -------------------------------------------------- -------------------------------------------------- ----------- Driver Provider JDBC Type Availability Version ----------------------------------------------------------------------------- -------------------------------------------------- ----------------------------- Freetds http://www.freetds.org/ Type 4 Free / Open Source Code --- -------------------------------------------------- -------------------------------------------------- -------- Merant DataDirect http://www.merant.com/ Type 4 Business Connect JDBC ------------------------- -------------------------------------------------- ------------------------------------ I-net Optajdbc http://www.inetsoftware.de/ TYPE 4 Business 4.10 Revision -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ----------------- WebLogicjdriver for WebLogic Type 4 Business MS SQL Server ------------------------ -------------------------------------------------- ------------------------------------- atinav aveconnect http://www.atinav.com/ type 4 Business JDBC ---------------------------- -------------------------------------------------- --------------------------------- Sun jdbc-ketbc bridge http://java.sun.com Type 4 Free -------------------------------------------------- -------------------------------------------------- ----------- Note * Sun JDBC-ODBC Bridge Driver and FreetDS JDBC Driver (at least the version of April 2001) Not recommended for official J2EE development and release SUN JDBC-ODBC The Bridge Driver Sun JDBC-ODBC Bridge driver is automatically installed during the Java 2 SDK installation. The installation package is Sun.jdbc.odbc. For all applications that use the JDBC-ODBC bridge, they must be in the classpath. In this tutorial, it is assumed that the Sun JDBC-ODBC bridge is installed in your system.
In order to use the Sun JDBC-ODBC bridge you need to create an ODBC data source to reference the MS SQL Server database. In this tutorial, it is assumed that the data source named JBoss_oDBC points to a MS SQLServer database is created.
Install the FreetDs driver Download FreeEtds from http://www.freetds.org, you should get files named Freetds_jdbc.snapshot.jar, then copy it to the% jboss_home / lib / ext directory. There are two ways to install the Merant DataDirect Connect JDBC driver, you can choose one of the following methods: 1. Run the merant installer and add Base.jar, Util.jar and SQLServer.jar files to the classpath. These files are located in the% merarant_home / lib directory. 2. Copy base.jar, UITL. Jar and SQLServer.jar files from the% merant_home / lib directory to% jboss_home / lib / ext directory, and recommend this method. Installing I-Net Opta 2000JDBCDRIVER You can use: 1. Add an OPTA2000.jar file to ClassPath when running JBOSS. 2. Copy the file Opta2000.jar to the% / jboss_home% / lib / ext directory. This is a recommended method.
Configuring JBOSS Using JDBC Drivers About configuring JBoss using your JDBC driver depends on the JBoss version you are using, select the method that suits your version. Configuring JBoss 2.4
Follow the guidance of JBoss2.1 and 2.2, but replace the org.opentools.minerva.jdbc.xa.wrapper.xADataSourceImpl to org.jboss.pool.jdbc.xa.wrapper.xadataSourceImpl.
Configuring JBoss2.1 and 2.2 Tell the JBoss JDBC driver After installing the MS SQL Server JDBC driver, you need to tell JBoss you want to use the driver. Add the driver to the JDBC list loaded when the JBoss startup is started. This list is stored in a jboss.jcml file. This file can be found in% jboss_home / conf /
Open the file, find the entry starting with the following MBean tag:
Add $ Sun JDBC-ODBC bridge driver
To create a connection pool, first locate the MBean entry starting at the following line in the jboss.jcml file:
/ Attribute>
If successful load JDBC driver will have the output shown below [Transaction manager] Initializing [Transaction manager] Loaded JDBC-driver: org.hsql.jdbcDriver [Transaction manager] Loaded JDBC-driver: org.enhydra.instantdb.jdbc.idbDriver [Transaction manager] Loaded JDBC-driver: sun.jdbc.odbc.JdbcOdbcDriver [Transaction manager] Loaded JDBC-driver: com.merant.datadirect.jdbc.sqlserver.SQLServerDriver [Transaction manager] Loaded JDBC-driver: com.inet.tds .TdsDriver [Transaction manager] Loaded JDBC-driver: weblogic.jdbc.mssqlserver4.Driver [Transaction manager] Initialized wait a moment ... output connection pool [SQLServerPool] Starting [SQLServerPool] XA connection pool SQLServerPool bound to java: / SQLServerPool [SQLServerPool] Started Configure CMP Data Type Mapping Configuration JBoss Use the MS SQL Server connection pool as the default data source, you can choose one of the following methods: $ Create Jaws.xml files in your application's meta-infirectory The default settings shown in STANDARDJAWS.XML Jaws.xml (MS SQL Server CMP Data Type Mapping) XML Version = "1.0" Encoding = "UTF-8"?>
type-mapping> type-mapings> jaws> $ Change the default setting in the StandardJaws.xml file under the% jboss_home% / conf directory To change the default data source and data type mapping, please pay for Standardjaws The .xml file is modified as follows XML Version = "1.0" Encoding = "UTF-8"?>