Skip to end of metadata
Go to start of metadata


This chapter describes how to integrate Altibase and JBoss.

JDBC Driver


JDBC is a standard interface that provides a Java application program to connect to a database and execute various SQLs.
These JDBC drivers are provided by each database vendor, and Altibase provides it as an Altibase.jar file.
This JDBC driver is in the $ALTIBASE_HOME/lib directory.

JDBC Driver Configuration


When using the connection pool by implementing it directly in the application program, the application program and the JDBC driver can be packaged together. However, if the user wants to access the data source through JNDI of JBoss, the JDBC driver must be located in a place accessible from all server configurations.

In the JBoss, if the JDBC driver (Altibase.jar) is placed in the JBOSS_HOME/common/lib directory, it can access from all server configurations.

Since the directory is not reflected dynamically, JBoss must be restarted after locating the JDBC driver.

DataSource parameters


The following are data source configuration parameters for interlocking Altibase and JBoss, and contain almost all configuration information that can be used when configuring the DataSource.

After checking the definition of the listed parameters, combine the required parameters, and set them in the data source file.

Data source files can be directly created by using a text editor, and are located in the JBOSS_HOME/server/default/deploy directory in the form of xx-ds.xml.

Parameter
Description
<jndi-name>
  • Set the name of the data source to be used
  • Use it by looking up Jndi-name in the application

<connection-url>

Set the URL of the DBMS to connect to

 

<driver-class>

Set the JDBC driver to be used when integrating with the DBMS

 

<user-name>

Set the user name

<password>

Set the password

<new-connection-sql>

Designate the SQL to be called when the connection is created

<check-valid-connection-sql>

Designate the SQL to be called when a connection is obtained from the connection pool

 

<valid-connection-checker-class-name>

Check the connection is valid before calling the connection from the connection pool

<exception-sorter-class-name>

When an error occurs, check the error code and message of the DBMS

 

<track-statements>

Monitoring option to track when statement and Resultset are unclosed

 

<prepared-statement-cache-size>

Reuse the number of Preparestatement to be cached per connection in the next call

 

<shared-prepared-statements>

Specify whether to cache Preparestatement. if it is called multiple times in the same transaction, a statement is returned.

Default: false

 

<query-timeout>

Set the SQL Timeout value

<background-validation>

The option used to reduce the overhead of checking if the connection is valid.

Default: false

<idle-timeout-minutes>

The maximum amount of time idle before the connection is closed.

Default: 15 minutes

 

<background-validation-minutes>

The cycle the Connectionvalidator runs.

Default: 10 minutes

 

<min-pool-size>

The minimum number of connection pools

 

<max-pool-size>

The maximum number of connection pools

 

<transaction-isolation>

If the Transaction Isolation Level is not specified, the default value of DBMS is used.

 

<metadata>

Type-mapping defined in the standardjbosscmp-jdbc.xml file


DataSource Configuration


This section describes how to configure the dataSource when integrating Altibase and JBoss.

Local Transaction


Because this is for the minimum DataSource configuration for integrating Altibase and JBoss, if additional items are needed, use the appropriate contents mentioned above.

The file name is saved in the form of "xx-ds.xml" and automatically detects and binds the data source file without restarting JBoss.

altibase-ds.xml


Distributed transaction


 

The following is an example of a data source file configuration when using a distributed transaction.

In the JBOSS_HOME/docs/jca directory, there is an example file for setting the data source for local/distributed transactions for each DBMS, so please refer to the setting.

Save the file in the form of “xx-xa-ds.xml”.

 

altibase-xa-ds.xml

 

Failover


Failover is a function to provide continuous service by detecting a failure of a DBMS in us and switching to another DBMS to prevent service interruption due to a DBMS failure.

There are two methods of the Failover function. Because Altibase only provides the failover function in version 5.3.3 or later, the syntax of JBOSS should be used when using a lower version. 

The following is the Failover using the syntax provided by Altibase. After modifying the DataSource file, shutting down the DBMS of the first URL, and testing it, then the failover to the DBMS of the second URL is done.

CTF (Connection Time Failover) and STF (Session Time Failover) are possible by using the syntax provided in Altibase.

altibase-ds.xml

The following is the Failover syntax provided by JBoss.

Add the connection-url of the DBMS to be failover, and designate the delimiter to separate the two URL as <url-delimiter>.

When using the syntax provided by JBoss, only CTF (Connection Time Failover) is possible. To test it, it is the same as above.

altibase-ds.xml
  • No labels