From: <ku...@us...> - 2001-03-28 04:44:45
|
User: kunle Date: 01/03/27 20:44:44 Added: src/docs howtomssql.xml Log: converted to new format. Added CMP info too Revision Changes Path 1.1 manual/src/docs/howtomssql.xml Index: howtomssql.xml =================================================================== <?xml version = "1.0" encoding = "UTF-8"?> <section> <title>HOWTO: Using MS SQL Server with JBoss</title> <para> <author> <firstname>Kunle</firstname> <surname>Odutola</surname> </author> <email>kun...@ho...</email> </para> <para> <author> <firstname>Anthony</firstname> <surname>Oguntimehin</surname> </author> </para> <section> <title>Introduction</title> <para> This document provides a concise and easy-to-read set of instructions that will get you up to speed quickly on the basics of using Microsoft's SQL Server relational database management system (RDBMS) with the JBoss J2EE application server suite to develop, deploy and run Enterprise Java applications that with CMP or BMP. </para> <para> <ulink url="http://www.jboss.org/">JBoss</ulink> is the brand name of the leading, Open Source, standards-compliant J2EE application server suite. The suite includes the JBossServer EJB v1.1 container and server, the JBossMQ JMS 1.0 implemetation, the JBossNS JNDI implemetation, the JBossCMP advanced O/R mapper and JDBC data object storage implementation and, the JAAS-based JBossSX security framework. All the JBoss applications are 100% Pure Java applications and are collectively the most innovative J2EE application server suite available with features including a much admired modular construction and an advanced plug-in architecture. </para> <para> <ulink url="http://www.microsoft.com/sql/">Microsoft SQL Server</ulink> is a robust, high performance and secure platforms for building and managing relational databases. It is a Windows application that runs on the Windows 95, 98, Me, NT and 2000 platforms. There is also a version for the Windows CE platform but I guess it is safe to assume you aren't using that version with JBoss. Or is it? </para> <para> The combination of the JBoss suite of high performance, Open Source, 100% Pure Java J2EE application servers and the ultra-high performance Microsoft SQL Server RDBMS offers you a J2EE development and deployment environment on the Windows platform with superior performance, good return on investment (ROI) and substantially reduced time to market (TTM) compared to other J2EE application suites and RDBMS solutions on the Windows platform. </para> <section id="INSTALL-MENU"> <title>C'mon, show me already</title> <para> Not so fast amigos. You need to obtain a copy of the JBoss distribution from the <ulink url="http://www.jboss.org/">JBoss website</ulink>. General information about all JBoss products as well as instructions on how to get a copy of JBoss for yourself can be found in the <ulink url="../business/faq.html">JBoss FAQ</ulink> or on the <ulink url="http://www.jboss.org/">JBoss website</ulink>. The rest of this document covers the following tasks: </para> <orderedlist> <listitem><link linkend="INSTALL-DRIVER">Install a JDBC Driver for MS SQL Server</listitem> <listitem><link linkend="CONFIGURE-JBOSS">Configure JBoss to use the JDBC driver</listitem> <listitem><link linkend="CONFIGURE-CMP">Specify appropriate MS SQL Server datatypes for CMP</listitem> <listitem><link linkend="TROUBLE-SHOOTING">Troubleshoot any problems</listitem> </orderedlist> <para> Now it is important to be aware that both the JBoss application server suite and MS SQL Server are still in active development. They are both evolving as issues are reported, fixed and new features are identified and added. This means that <emphasis>some of the information contained in this document may be out of date with respect to your copy of JBoss or MS SQL Server</emphasis>. This is even more likely to be the case if you are using the latest CVS or developer version of JBoss or a beta of MS SQL Server. </para> <para> If this is the case with you or, if you have any further comments or suggestions about this document or JBoss then please join the <link url="../business/list.html">JBoss mailing list</link>. You will then be able to contribute to the production of this document and the development of JBoss. </para> </section> </section> <section id="INSTALL-DRIVER"> <title>Install a JDBC driver</title> <para> Before you can use Microsoft SQL Server with JBoss (or indeed any other Java application) you must obtain and install a compatible JDBC driver. Some of the many JDBC drivers that exist for Microsoft SQL Server are listed below. </para> <table> <tgroup cols="4" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Driver</entry> <entry>Supplier</entry> <entry>JDBC Type</entry> <entry>Availability</entry> </row> </thead> <tbody> <row> <entry>FreeTDS</entry> <entry><ulink url="htttp:/www.freetds.org/>www.freetds.org</ulink></entry> <entry>Type 4</entry> <entry>Free/Open Source</entry> </row> <row> <entry>Merant DataDirect Connect JDBC</entry> <entry><ulink url="htttp:/www.merant.com/>www.merant.com</ulink></entry> <entry>Type 4</entry> <entry>Commercial</entry> </row> <row> <entry>i-net Opta JDBC</entry> <entry><ulink url="htttp:/www.inetsoftware.de/>www.inetsoftware.de</ulink></entry> <entry>Type 4</entry> <entry>Commercial</entry> </row> <row> <entry>Atinav aveConnect JDBC</entry> <entry><ulink url="htttp:/www.atinav.com/>www.atinav.com</ulink></entry> <entry>Type 4</entry> <entry>Commercial</entry> </row> <row> <entry>Sun JDBC-ODBC Bridge<superscript>*</superscript></entry> <entry><ulink url="htttp:/java.sun.com/jdbc/>java.sun.com</ulink></entry> <entry>Type 4</entry> <entry>Free</entry> </row> </tbody> </tgroup> <table> <note><superscript>*</superscript> The Sun JBDC-ODBC Bridge driver is NOT recommended for serious J2EE development or deployment</note> <para> For the remainder of this document, the Sun JDBC-ODBC bridge, the Merant DataDirect Connect JDBC 2.0 Client and the i-net OPTA 2000 JDBC drivers will be used to illustrate the use of MS SQL Server with JBoss. </para> <section> <title>Installing the Sun JBDC-ODBC bridge driver</title> <para> The Sun ODBC-JDBC driver is installed automatically during the Java 2 SDK installation process. It is installed as package <filename>sun.jdbc.odbc</filename>. This package must be in the <envar>CLASSPATH</envar> for any application that uses the JDBC-ODBC bridge. For this tutorial it will be assumed that the Sun JDBC-ODBC bridge is properly installed on your system. </para> <para> To use the Sun JDBC-ODBC bridge with JBoss and MS SQL Server you need to create an ODBC datasource that references your MS SQL Server database. For this tutorial it will be assumed that a datasource named <replaceable>jboss_odbc</replaceable> has been created that points to an MS SQL Server database. </section> <section> <title>Installing the Merant DataDirect Connect JDBC driver</title> <para> According to the blurb on Merant's site: </para> <blockquote> "Connect JDBC are optimized and reliable Type 4 JDBC drivers for accessing data from Java applets or applications. Connect JDBC supports the latest Sun JDBC specification and the J2EE framework, providing highly scalable data access from heterogeneous platforms, and offering greater flexibility for today's demanding corporate environment." </blockquote> <para> The Merant DataDirect Connect JDBC driver's .jar files must be accessible to JBoss. There are two ways to accomplish this, you should choose one of the following options: </para> <orderedlist> <listitem><para> Run Merant's installation program then add the <filename>base.jar</filename>, <filename>util.jar</filename> and <filename>sqlserver.jar</filename> files to the <envar>CLASSPATH</envar>. The files are located in the <filename>%MERANT_HOME%/lib</filename> directory on Windows. </para></listitem> <listitem><para> Copy the <filename>base.jar</filename>, <filename>util.jar</filename> and <filename>sqlserver.jar</filename> files from the <filename>%MERANT_HOME%/lib</filename> directory to the <filename>%JBOSS_HOME%/lib/ext</filename> directory. This is the recommended option. </para></listitem> </orderedlist> </section> <section> <title>Installing the i-net OPTA 2000 JDBC driver</title> <para> According to the blurb on i-net's site: </para> <blockquote> "i-net software announces the availability of i-net OPTA™ 2000. This version features i-net PLEXA&trade, a pool manager that comes with i-net OPTA&trade free of charge. The easy to use pool manager is a means of seamlessly employing connection pooling with i-net OPTA." </blockquote> <para> The i-net OPTRA 2000 JDBC driver's .jar files must be accessible to JBoss. There are two ways to accomplish this, you should choose one of the following options: </para> <orderedlist> <listitem><para> Add the <filename>Optra2000.jar</filename> file to your <envar>CLASSPATH</envar> when running JBoss. </para></listitem> <listitem><para> Copy the <filename>Optra2000.jar</filename> file to the <filename>%JBOSS_HOME%/lib/ext</filename> directory. This is the recommended option. </para></listitem> </orderedlist> <para> Back to <link linkend="INSTALL-MENU">install menu</link> </para> </section> </section> <section id="CONFIGURE-JBOSS"> <title>Configure JBoss to use the JDBC driver</title> <para> The instructions for configuring JBoss to use your JDBC driver is different depending on the version of JBoss you have. Please select the appropriate link for your version: </para> <itemizedlist> <listitem><para> <link linkend="CONFIGURE-JBOSS2" endterm="CONFIGURE-JBOSS2"></link> </para></listitem> <listitem><para> <link linkend="CONFIGURE-JBOSS2" endterm="CONFIGURE-JBOSS2X"></link> </para></listitem> </itemizedlist> <section id="CONFIGURE-JBOSS2"> <title>Configure JBoss 2.0 FINAL</title> <section> <title>Tell JBoss about the new JDBC driver</title> <para> Now that you have installed a JDBC driver for MS SQL Server, you need to tell JBoss that you would like it to use this driver. Do this by adding an entry for the driver to the list of JDBC drivers that JBoss loads at startup. This list is stored in the <filename>jbdc.drivers</filename> entry in the <filename>jboss.properties</filename> file. The <filename>jboss.properties</filename> file can be found in <filename>%JBOSS_HOME%/conf/</filename><replaceable><config-name></replaceable>. For a standard distribution of JBoss, <replaceable><config-name></replaceable> is <filename>default</filename> whilst for the JBoss-Jetty it is <filename>jetty</filename>. The <filename>jbdc.drivers</filename> entry should be a single, continuous string of JDBC driver names separated with a comma. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Sun JDBC-ODBC bridge JDBC driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,<replaceable>sun.jdbc.odbc.JdbcOdbcDriver</replaceable> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Merant DataDirect Connect JDBC 2.0 driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,<replaceable>com.merant.datadirect.jdbc.sqlserver.SQLServerDriver</replaceable> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>i-net OPTA 2000 <replaceable>(v2.05 or higher)</replaceable></entry> </row> </thead> <tbody> <row> <entry><programlisting> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,<replaceable>com.inet.tds.TdsDriver</replaceable> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section> <title>Check that JBoss now loads the new JDBC driver</title> <para> Start JBoss and ensure that the JDBC driver is found (the relevant output would be similar to the output shown below). Stop JBoss afterwards. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Sun JDBC-ODBC bridge JDBC driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> [JDBC] Loaded JDBC-driver:org.hsql.jdbcDriver [JDBC] Loaded JDBC-driver:org.enhydra.instantdb.jdbc.idbDriver [JDBC] Loaded JDBC-driver:<replaceable>sun.jdbc.odbc.JdbcOdbcDriver</replaceable> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Merant DataDirect Connect JDBC 2.0 driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> [JDBC] Loaded JDBC-driver:org.hsql.jdbcDriver [JDBC] Loaded JDBC-driver:org.enhydra.instantdb.jdbc.idbDriver [JDBC] Loaded JDBC-driver:<replaceable>com.merant.datadirect.jdbc.sqlserver.SQLServerDriver</replaceable> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>i-net OPTA 2000 <replaceable>(v2.05 or higher)</replaceable></entry> </row> </thead> <tbody> <row> <entry><programlisting> [JDBC] Loaded JDBC-driver:org.hsql.jdbcDriver [JDBC] Loaded JDBC-driver:org.enhydra.instantdb.jdbc.idbDriver [JDBC] Loaded JDBC-driver:<replaceable>com.inet.tds.TdsDriver</replaceable> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section> <title>Declare a DB Connection pool</title> <para> At this point, you know that the driver is correctly installed. You will now set up a connection pool that your EJBeans can connect to. Add an MLET entry into the <filename>jboss.conf</filename> file as shown below. The file can be found in <filename>%JBOSS_HOME%/conf/</filename> <replaceable><config-name></replaceable>. </para> <para> For this tutorial, you will create a connection pool named <replaceable>SQLServerPool</replaceable> as specified in the first argument in the MLET entry. The second argument in the MLET entry should be your driver's <filename>XADataSource</filename> classname. If your driver doesn't support <filename>XADataSource</filename> use <filename>org.jboss.minerva.xa.XADataSourceImpl</filename> instead. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Sun JDBC-ODBC bridge JDBC driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar,rt.jar" CODEBASE="../lib/ext/"> <ARG TYPE="java.lang.String" VALUE="<replaceable>SQLServerPool</replaceable>"> <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl"> </MLET> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Merant DataDirect Connect JDBC 2.0 driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar,base.jar,util.jar,sqlserver.jar" CODEBASE="../lib/ext/"> <ARG TYPE="java.lang.String" VALUE="<replaceable>SQLServerPool</replaceable>"> <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl"> </MLET> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>i-net OPTA 2000 <replaceable>(v2.05 or higher)</replaceable></entry> </row> </thead> <tbody> <row> <entry><programlisting> <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar,Opta200.jar" CODEBASE="../lib/ext/"> <ARG TYPE="java.lang.String" VALUE="<replaceable>SQLServerPool</replaceable>"> <ARG TYPE="java.lang.String" VALUE="com.inet.tds.XDataSource"> </MLET> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section> <title>Configure the DB Connection pool</title> <para> Before you can use your spanking new connection pool, you need to tell it how to find your database server (you can also take this chance to specifiy other configuration parameters for the pool like <envar>LoggingEnabled</envar>). Tell your pool how to connect to your database server by adding an MBEAN entry into the <filename>jboss.jcml</filename> file as shown below. The file can be found in <filename>%JBOSS_HOME%/conf/</filename><replaceable><config-name></replaceable>. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Sun JDBC-ODBC bridge JDBC driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean name=";DefaultDomain:service=XADataSource,name=<replaceable>SQLServerPool</replaceable>";> <attribute name="URL">jdbc:odbc:<replaceable>jboss_odbc</replaceable></attribute> <attribute name="JDBCUser"><replaceable>dbusername</replaceable></attribute> <attribute name="Password"><replaceable>dbpassword</replaceable></attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Merant DataDirect Connect JDBC 2.0 driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean name="DefaultDomain:service=XADataSource,name=<replaceable>SQLServerPool</replaceable>";> <attribute name="URL">jdbc:sqlserver://<replaceable>servername</replaceable>:1433</attribute> <attribute name="Properties">DatabaseName=<replaceable>DatabaseName</replaceable></attribute> <attribute name="JDBCUser"><replaceable>dbusername</replaceable></attribute> <attribute name="Password"><replaceable>dbpassword</replaceable></attribute> <attribute name="MinSize">0</attribute> <attribute name="MaxSize">10</attribute> <attribute name="GCEnabled">false</attribute> <attribute name="GCMinIdleTime">1200000</attribute> <attribute name="GCInterval">120000</attribute> <attribute name="InvalidateOnError">false</attribute> <attribute name="TimestampUsed">false</attribute> <attribute name="Blocking">true</attribute> <attribute name="LoggingEnabled">false</attribute> <attribute name="IdleTimeoutEnabled">false</attribute> <attribute name="IdleTimeout">1800000</attribute> <attribute name="MaxIdleTimeoutPercent">1.0</attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>i-net OPTA 2000 <replaceable>(v2.05 or higher)</replaceable></entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean name="DefaultDomain:service=XADataSource,name=<replaceable>SQLServerPool</replaceable>";> <attribute name="Properties">host=<replaceable>ServerName</replaceable>; database=<replaceable>DatabaseName</replaceable></attribute> <attribute name="JDBCUser"><replaceable>dbusername</replaceable></attribute> <attribute name="Password"><replaceable>dbpassword</replaceable></attribute> <attribute name="MinSize">0</attribute> <attribute name="MaxSize">10</attribute> <attribute name="GCEnabled">false</attribute> <attribute name="GCMinIdleTime">1200000</attribute> <attribute name="GCInterval">120000</attribute> <attribute name="InvalidateOnError">false</attribute> <attribute name="TimestampUsed">false</attribute> <attribute name="Blocking">true</attribute> <attribute name="LoggingEnabled">false</attribute> <attribute name="IdleTimeoutEnabled">false</attribute> <attribute name="IdleTimeout">1800000</attribute> <attribute name="MaxIdleTimeoutPercent">1.0</attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section> <title>Check the DB Connection pool</title> <para> Start JBoss and ensure that the JDBC driver is found (the relevant output would be similar to the output shown below). Stop JBoss afterwards. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <tbody> <row> <entry><programlisting> [SQLServerPool] Starting [SQLServerPool] XA Connection pool SQLServerPool bound to java:/SQLServerPool [SQLServerPool] Started </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <para> Back to <link linkend="INSTALL-MENU">install menu</link> </para> </section> <section id="CONFIGURE-JBOSS2X"> <title>Configure JBoss 2.1 and later</title> <section> <title>Tell JBoss about the new JBDC driver</title> <para> Now that you have installed a JDBC driver for MS SQL Server, you need to tell JBoss that you would like it to use this driver. Add an entry for the driver to the list of drivers that JBoss loads at startup. This list is stored in the <filename>jboss.jcml</filename> file. The file can be found in <filename>%JBOSS_HOME%/conf/</filename><replaceable><config-name></replaceable>. For a standard distribution of JBoss, <replaceable><config-name></replaceable> is <filename>default</filename> whilst for the JBoss-Jetty it is <filename>jetty</filename>. The entry should be a single, continuous list of comma-separated JDBC driver names. </para> <para> Open the file and look for the entry that begins with the following <filename>mbean</filename> tag: </para> <para> <prompt><mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider"></prompt> </para> <para> The list of drivers is kept in an <filename><attribute></filename> sub-tag of this entry named <filename>Drivers</filename>. Add your JBDC driver to the list as shown below. When you've finished, keep the file open in your editor. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Sun JDBC-ODBC bridge JDBC driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider"> <attribute name="<replaceable>Drivers</replaceable>"> org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver,<replaceable>sun.jdbc.odbc.JdbcOdbcDriver</replaceable> </attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Merant DataDirect Connect JDBC 2.0 driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider"> <attribute name="<replaceable>Drivers</replaceable>"> org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver,<replaceable>com.merant.datadirect.jdbc.sqlserver.SQLServerDriver</replaceable> </attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>i-net OPTA 2000 <replaceable>(v2.05 or higher)</replaceable></entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider"> <attribute name="<replaceable>Drivers</replaceable>"> org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver,<replaceable>com.inet.tds.TdsDriver</replaceable> </attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section> <title>Create a DB Connection pool</title> <para> At this point, you have told JBoss about your driver. You will now set up a connection pool that your EJBeans can connect to. For this tutorial, you will create a connection pool named <replaceable>SQLServerPool</replaceable>. To create the connection pool, locate the <filename>mbean</filename> entry that begins with the following line in the <filename>jboss.jcml</filename> file (you should have kept it open as advised in the last step): </para> <para> <prompt><mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=DefaultDS"></prompt> </para> <para> Add the <filename>mbean</filename> entry given below to the file just <emphasis>below</emphasis> the <filename>mbean</filename> entry you have just located above. This should be added after the closing <filename></mbean></filename> tag!!. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Sun JDBC-ODBC bridge JDBC driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean code="<replaceable>org.jboss.jdbc.XADataSourceLoader</replaceable>" name="DefaultDomain:service=XADataSource,name=<replaceable>SQLServerPool</replaceable>"> <attribute name="DataSourceClass"><replaceable>org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</replaceable></attribute> <attribute name="PoolName"><replaceable>SQLServerPool</replaceable></attribute> <attribute name="URL">jdbc:odbc:<replaceable>jboss_odbc</replaceable></attribute> <attribute name="JDBCUser"><replaceable>dbusername</replaceable></attribute> <attribute name="Password"><replaceable>dbpassword</replaceable></attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>Merant DataDirect Connect JDBC 2.0 driver</entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean code="<replaceable>org.jboss.jdbc.XADataSourceLoader</replaceable>" name="DefaultDomain:service=XADataSource,name=<replaceable>SQLServerPool</replaceable>"> <attribute name="DataSourceClass"><replaceable>org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</replaceable></attribute> <attribute name="PoolName"><replaceable>SQLServerPool</replaceable></attribute> <attribute name="URL">jdbc:sqlserver://<replaceable>servername</replaceable>:1433</attribute> <attribute name="Properties">DatabaseName=<replaceable>DatabaseName</replaceable></attribute> <attribute name="JDBCUser"><replaceable>dbusername</replaceable></attribute> <attribute name="Password"><replaceable>dbpassword</replaceable></attribute> <attribute name="MinSize">0</attribute> <attribute name="MaxSize">10</attribute> <attribute name="GCEnabled">false</attribute> <attribute name="GCMinIdleTime">1200000</attribute> <attribute name="GCInterval">120000</attribute> <attribute name="InvalidateOnError">false</attribute> <attribute name="TimestampUsed">false</attribute> <attribute name="Blocking">true</attribute> <attribute name="LoggingEnabled">false</attribute> <attribute name="IdleTimeoutEnabled">false</attribute> <attribute name="IdleTimeout">1800000</attribute> <attribute name="MaxIdleTimeoutPercent">1.0</attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <thead> <row> <entry>i-net OPTA 2000 <replaceable>(v2.05 or higher)</replaceable></entry> </row> </thead> <tbody> <row> <entry><programlisting> <mbean code="<replaceable>org.jboss.jdbc.XADataSourceLoader</replaceable>" name="DefaultDomain:service=XADataSource,name=<replaceable>SQLServerPool</replaceable>"> <attribute name="DataSourceClass"><replaceable>com.inet.tds.XDataSource</replaceable></attribute> <attribute name="PoolName"><replaceable>SQLServerPool</replaceable></attribute> <attribute name="Properties">host=<replaceable>ServerName</replaceable>; database=<replaceable>DatabaseName</replaceable></attribute> <attribute name="JDBCUser"><replaceable>dbusername</replaceable></attribute> <attribute name="Password"><replaceable>dbpassword</replaceable></attribute> <attribute name="MinSize">0</attribute> <attribute name="MaxSize">10</attribute> <attribute name="GCEnabled">false</attribute> <attribute name="GCMinIdleTime">1200000</attribute> <attribute name="GCInterval">120000</attribute> <attribute name="InvalidateOnError">false</attribute> <attribute name="TimestampUsed">false</attribute> <attribute name="Blocking">true</attribute> <attribute name="LoggingEnabled">false</attribute> <attribute name="IdleTimeoutEnabled">false</attribute> <attribute name="IdleTimeout">1800000</attribute> <attribute name="MaxIdleTimeoutPercent">1.0</attribute> </mbean> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section> <title>Check the DB Connection pool</title> <para> Start JBoss and ensure that the JDBC driver is found and the connection pool is created. The relevant out put is shown below for successful JBDC driver load. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <tbody> <row> <entry><programlisting> [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:com.merant.datadirect.jdbc.sqlserver.SQLServerDriver [Transaction manager] Initialized </programlisting></entry> </row> </tbody> </tgroup> <table> <para> And a litte later...the output for the connection pool. Stop JBoss afterwards. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <tbody> <row> <entry><programlisting> [SQLServerPool] Starting [SQLServerPool] XA Connection pool SQLServerPool bound to java:/SQLServerPool [SQLServerPool] Started </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <para> Back to <link linkend="INSTALL-MENU">install menu</link> </para> </section> <section id="CONFIGURE-CMP"> <title>Configure DataType Mappings for CMP</title> <para> To configure JBoss so that it uses your MS SQL Server connection pool as the default data source for CMP operations, provide a <filename>jaws.xml</filename> file as shown below. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <tbody> <row> <entry><programlisting> <![CDATA[ <?xml version="1.0" encoding="UTF-8"?> <jaws> <datasource>java:/SQLServerPool</datasource> <type-mapping>MS SQLSERVER</type-mapping> <default-entity> <remove-table>false</remove-table> </default-entity> <type-mappings> <type-mapping> <name>MS SQLSERVER</name> <!-- INSERT MAPPINGS FROM standardjaws.xml HERE --> </type-mapping> </type-mappings> </jaws> ]]> </programlisting></entry> </row> </tbody> </tgroup> <table> </section> <section id="TROUBLE-SHOOTING"> <title>Troubleshooting</title> <section id="TROUBLE-DRIVER-LOAD"> <title>JDBC driver not loaded error</title> <para> Error message shown on start-up: </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <tbody> <row> <entry><programlisting> [JDBC] Could not load driver:sun.jdbc.odbc.JdbcOdbcDrivers </programlisting></entry> </row> </tbody> </tgroup> <table> <para> This error can occur in the following situations: </para> <orderedlist> <listitem><para> the spelling of a JDBC driver name in the <filename>jboss.properties</filename> configuration file (or <filename>jboss.jcml</filename> for JBoss 2.1 and later) is incorrect. In the example above it should have been <filename>sun.jdbc.odbc.JdbcOdbcDriver</filename>. </para></listitem> <listitem><para> a JDBC driver has not been properly installed - it's class files or .jar file(s) are not in the <envar>CLASSPATH</envar> </para></listitem> </orderedlist> </section> <section> <title>JBoss hangs while starting connection pool</title> <para> When JBoss is started, the sequence of messages that is shown on the console stops midway. The last displayed message refers to a connection pool as shown below. </para> <table> <tgroup cols="1" align="center" colsep="1" rowsep="1"> <tbody> <row> <entry><programlisting> [Hypersonic] Press [Ctrl]+[C] to abort [InstantDB] Started [DefaultDS] Starting [DefaultDS] XA Connection pool DefaultDS bound to java:/DefaultDS [DefaultDS] Started[SQLServerPool] Starting [SQLServerPool] XA Connection pool SQLServerPool bound to java:/SQLServerPool </programlisting></entry> </row> </tbody> </tgroup> <table> <para> Check that your JDBC driver is loaded correctly. If not then see <xref linkend="TROUBLE-DRIVER-LOAD"></xref> for possible clues. If your JDBC driver is loading correctly then this error indicates that JBoss is unable to communicate with your database server. </para> <para> It can occur in the following situations: </para> <orderedlist> <listitem><para> the spelling of one or more of the parameters needed to connect to the database server is mispelled or missing. Please check that you have specified the correct hostname, database, username, password etc for the connection pool. </para></listitem> </orderedlist> </section> <para> Back to <link linkend="INSTALL-MENU">install menu</link> </para> </section> </section> </section> |