JBoss MS SQL Server Configuration Guide

xiaoxiao2021-03-06  107

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 / . For standard JBoss release, is a default and the JBoss-Jetty version is Jetty. The entrance should be a list of JDBC driver names separately with a comma.

Open the file, find the entry starting with the following MBean tag: Driver list is placed in the sub-tag named Driver in. Add your JDBC driver to the list as shown below.

Add $ Sun JDBC-ODBC bridge driver org.hsql.jdbcDriver, org.enhydra. instantdb.jdbc.idbDriver, sun.jdbc.odbc.JdbcOdbcDriver $ Add FreeTDS driver < attribute name = "drivers"> org.hsql.jdbcDriver, org.enhydra.instantdb.jdbc.idbDriver, com.internetcds.jdbc.tds.Driver $ Add Merant DataDirect Connect JDBC driver org.hsql.jdbcDriver, org.enhydra.instantdb.jdbc.idbDriver, com.merant.datadirect .jdbc.sqlserver.SQLServerDriver $ added i-net OPTA 2000 JDBC driver Org.hsql.jdbcdriver, org.enhydra.instantdb.jdbc.idbdriver, com.inet.tds.tdsdriver $ Add WebLogic JDR iver for Microsoft SQL Server org.hsql.jdbcDriver, org.enhydra.instantdb.jdbc. iDBDriver, WebLogic.jdbc.msqlserver4.driver Create a DB connection pool to now, you have told JBoss your driver. Now create a connection pool that your EJBBean can connect. In this tutorial, you will create a connection pool called SQLServerPool.

To create a connection pool, first locate the MBean entry starting at the following line in the jboss.jcml file: org.opentools. minerva.jdbc.xa.wrapper.XADataSourceImpl SQLServerPool jdbc: odbc: jboss_odbc dbusername dbpassword etc ... $ Merant DataDirect connect JDBC driver connection pool statement org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl SQLServerPool jdbc: sqlserver: // servername: 1433 DatabaseName = DatabaseName dbusername dbpassword etc ... $ i-net OPTA 2000 JDBC Driver connection pool statement (data source using INET) com.inet.tds.xdataserce SQLServerPool <

/ Attribute> host = ServerName; database = DatabaseName dbusername dbpassword etc. . $ I-NET OPTA 2000 JDBC Driver Connection Pool Declaration (using JBoss Data Source) org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl SQLServerPool jdbc: inetdae7 : HostName dbusername dbpassword etc ... $ WebLogic jDriver for Microsoft SQL Server connection pooling statement org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl SQLServerPool jdbc: weblogic: mssqlserver4: DatabaseName @ ServerName: 1433 user = dbusername; password = dbpassword etc ... start test DB connection pool JBoss ensures that the JDBC driver finds and creates a connection pool.

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) Java: / Sqlserverpool ms sqlserver false MS SQLSERVER

$ 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 java: / sqlserverpool ms sqlserver * Note: In addition to MS SQLServer 2000, other versions use MS SQLServer. If you use SQL Server2000, change the above MS SQLServer to MS SQLServer2000.

转载请注明原文地址:https://www.9cbs.com/read-103549.html

New Post(0)