Document Type | Technical Information
Category | Interface/Integration
Document Number | TIITI013
Overview
This explains how to copy the JDBC Driver file and create a datasource configuration file for Tibero integration in environments using JBoss 6.x and below.
Details about specific configuration items are omitted; for more information, please refer to the official JBoss documentation or the RedHat community.
NoteTesting was conducted in the following environment.
OS: Linux kernel 2.6 (CentOS 6.5)
JDK: Oracle JDK 1.7
JBoss: JBoss AS 6.1.0 (standard instance)
Method
Copy Tibero JDBC Driver File
Copy the Tibero JDBC Driver file into the lib directory of the instance ($JBOSS_HOME/server/<Instance>/lib).
$ cp $TB_HOME/client/lib/jar/tibero6-jdbc.jar $JBOSS_HOME/server/standard/lib/
Create Datasource Configuration File
Create a Tibero-ds.xml file in the deploy directory of the instance ($JOSS_HOME/server/standard/deploy).
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>TiberoDS</jndi-name>
<connection-url>jdbc:tibero:thin:@localhost:8629:tb6</connection-url>
<driver-class>com.tmax.tibero.jdbc.TbDriver</driver-class>
<user-name>tibero</user-name>
<password>tmax</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>After completion, when you start JBoss, you can confirm that the Tibero DataSource is bound as shown below.

Verify Tibero Integration
Deploy a simple Web Application on JBoss to test querying database information through the Tibero DataSource.
NoteThe method for deploying Web Applications on JBoss AS is not covered in this document. For related information, please refer to the JBoss website, community, or Red Hat technical documents.
Create Web Application
Create a simple JSP file that connects to Tibero and queries sysdate.
- JSP Example (tbtest.jsp)
<%@ page import="java.sql.*" %> <%@ page import="javax.sql.*" %> <%@ page import="javax.naming.*" %> <% Connection con=null; Statement st=null; ResultSet rs=null; try { InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource) initCtx.lookup("java:/TiberoDS"); con = ds.getConnection(); st = con.createStatement(); rs = st.executeQuery("SELECT sysdate FROM dual;"); while(rs.next()) { out.println(rs.getString(1)); } } catch(Exception e) { out.print("Error!\n"); out.println(e); } finally { if(rs != null) rs.close(); if(st != null) st.close(); if(con != null) con.close(); } %>