16.2. Installing JDBC Drivers

To use the selected external database, you must also install the JDBC driver for your database. The JDBC driver is a JAR file, which must be placed into the <JBOSS_HOME>/server/<PROFILE>/lib directory. Replace <PROFILE> with the server profile you are using.
This file is loaded when JBoss Enterprise Application Platform starts up, so if you have the JBoss Enterprise Application Platform running, you will need to shut down and restart. Review the list below for a suitable JDBC driver. For a full list of certified JBoss Enterprise Application Platform database drivers, refer to http://www.jboss.com/products/platforms/application/supportedconfigurations/#JEAP5-0. If the links fail to work, please file a JIRA against this documentation, but be aware that Red Hat does not control these external links. Contact your database vendor for the most current version of the driver for your database.

JBDC Driver Download Locations

MySQL
PostgreSQL
Oracle
IBM
Sybase
Download from the Sybase jConnect product page http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/jconnect.

Note

When using Sybase database with this driver, the MaxParams attribute cannot be set higher than 481 due to a limitation in the driver's PreparedStatement class.
Microsoft
Download from the MSDN web site http://msdn.microsoft.com/data/jdbc/.

16.2.1. Special Notes on Sybase

Some of the services in JBoss uses null values for the default tables that are created. Sybase Adaptive Server should be configured to allow nulls by default.
sp_dboption db_name, "allow nulls by default", true
Refer to the Sybase manuals for more options.
Additionally, text and image values stored in the database can be very large. When a select list includes both text and image values, the length limit of the data returned is determined by the @@textsize global variable. The default setting for this variable depends on the software used to access Adaptive Server. For the JDBC driver, the default value is 32 kilobytes.

16.2.1.1. Enable JAVA services

To use any Java service (for example; JMS, CMP, timers) configured with Sybase, Java must be enabled on Sybase Adaptive Server. To do this use:
sp_configure "enable java",1
Refer to the sybase manuals for more information.
If Java is not enabled for Sybase Adaptive Server, the following error message may be echoed in the console.
com.sybase.jdbc2.jdbc.SybSQLException: Cannot run this command because Java services are not
        enabled. A user with System Administrator (SA) role must reconfigure the system to enable Java

16.2.1.2. CMP Configuration

To use Container Managed Persistence for user defined Java objects with Sybase Adaptive Server Enterprise, the Java classes should be installed in the database. The system table sysxtypes contains one row for each extended Java-SQL datatype. This table is only used for Adaptive Servers enabled for Java. Install Java classes using the installjava program.
installjava -f <jar-file-name> -S<sybase-server> -U<super-user> -P<super-pass> -D<db-name>
Refer to the installjava manual in Sybase for more options.

16.2.1.3. Installing Java Classes

  1. You have to be a super-user with required privileges to install Java classes.
  2. The JAR file you are trying to install should be created without compression.
  3. Java classes that you install and use in the server must be compiled with JDK 1.2.2. If you compile a class with a later JDK, you will be able to install it in the server using the installjava utility, but you will get a java.lang.ClassFormatError exception when you attempt to use the class. This is because Sybase Adaptive Server uses an older JVM internally, and requires the Java classes to be compiled with the same.

16.2.1.4. Increase @@textsize Default for Sybase v15.0.3

A problem with the default maximum text size value returned from the database may cause some tests to fail on JBoss Messaging. To correct the issue, change the default @@textsize value from 32768 (bytes) to 2147483647 (bytes).
Make the change in the sybase-ds.xml file inside a <connection-url> directive. An example sybase-ds.xml file is located in <JBOSS_HOME>/jboss-as/docs/examples/jca/

Important

Specify the entire URL to the database as the directive value. Replace [domain] with the domain name or IP address hosting the Sybase Database, and [port] with the port configured to accept requests.
<connection-url>jdbc:sybase:[domain]:[port]/db_name?SQLINITSTRING=set TextSize 2147483647</connection-url>