Skip to end of metadata
Go to start of metadata


This chapter describes how to integrate ALTIBASE and TOMCAT.

There are two methods to integrate: using DBCP (regular JDBC) or using ALTIBASE ConnecitonPool.

JNDI DataSource Integration

To configure JNDI DataSource, write the following in $CATALINA_HOME/conf/context.xml.

It can be used on the web by adding the following contents to the web application home/WEB-INF/web.xml.

Web application home/WEB-INF/web.xml

The properties defined in the tag are as follows.

driverClassName

Altibase JDBC driver class Name

url

The connection string information for connecting with ALTIBASe. Enters jdbc:Altibase://IP:port_no/db_name"

 

Username

The database account

 

Password

The database password

maxActive

The maximum number of connections, 0 is unlimited. The default is 8.

 

initialSize

The initial size of connections. The default is 0.

 

maxIdle

The maximum number of connections that wait in the pool. The default is 8.

 

minIdle

The minimum number of connections that wait in the pool. The default is 0.

 

maxWait

The maximum connection attempt time (unit: millisec) -1 waits indefinitely. The default: infinite waiting.

validationQuery

The SQL statement used to check the validation of connection

Must be specified as a select statement that returns at least one row

Ex) select 1 from dual

defaultAutoCommit

Sets autocommit mode. The default: true.

defaultTransactionIsolation

Sets Transaction Isolation level.

The values of REPEATABLE_READ, SERIALIZABLE, and the default can be set, and the default follows the default value of the DB server.

The isolation level of ALTIBASE is READ COMMITED by default.

removeAbandoned

Determines the removal function for the abandoned connection. The default is false.

When the connection is removed, the number of connections exceeds the value set for maxActive and is requested for connection.

The connection can be assigned when maxActive is not reached, abandoned connection removal does not occur.

 

removeAbandonedTimeout

Sets the time for removal of abandoned timeout. The default is 300.

 

logAbandoned

Determines whether to abandon stack information in the log when removing abandoned connections. The default is false.

In the program, the connection obtained with JNDI Datasource as follows.

In this case, java:/comp/env is a prefix used when looking up JNDI.

Or

The following is a jsp example program that integrates with ALTIBASE using the JNDI Datasource set above.

Integration with general JDBC method

  1. Load the JDBC driver.
  2. Get the Connection object.
  3. Get the Statement object.
  4. Execute the SQL statement and place it in the ResultSet.
  5. Close all related objects after the operation is completed.

The following is a jsp example program that integrates with ALTIBASe using the general JDBC method.

  • No labels