Version 6

    Teiid can be configured as a JDBC data source in the JBoss Application Server and can be accessed through the JNDI tree for your application.  Deploying Teiid as data source in JBoss AS is no different than deploying any other JDBC resource like Oracle or DB2.

     

    Note: If you are using Teiid version prior to 6.2 follow the directions here.

     

    Before we begin, make sure you have installed Teiid runtime using these directions and deployed your VDB into the Teiid using these directions. If you do not have a VDB, please check out Teiid Designer for creating a new VDB or follow these instructions to create a simple VDB without Designer for data integration purposes. If you do not know what a VDB is then please start with these documents.

     

    Teiid "Server" as Data Source

    1. Copy the "teiid-${version}-client.jar" file from "<teiid-install>/client" directory into "<jboss-install>/server/default/lib" directory.
    2. Create a "teiid-ds.xml" file in "<jboss-install>/server/default/deploy" directory.  The contents of the file should look like:

     

      <datasources>
      <xa-datasource>
        <jndi-name>TEIID-DS</jndi-name>
        <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
        <xa-datasource-property name="DatabaseName">myVDB</xa-datasource-property>
        <xa-datasource-property name="serverName">localhost</xa-datasource-property> 
        <xa-datasource-property name="portNumber">31000</xa-datasource-property> 
        <xa-datasource-property name="user">admin</xa-datasource-property> 
        <xa-datasource-property name="password">password</xa-datasource-property> 
        <track-connection-by-tx>true</track-connection-by-tx>
        <isSameRM-override-value>false</isSameRM-override-value>
        <no-tx-separate-pools />
    
        <!-- pool and other JBoss datasource properties -->
        <min-pool-size>5</min-pool-size> 
        <max-pool-size>10</max-pool-size>                
      </xa-datasource>        
      </datasources>
    

     

    The above XML fragment will create  an XA data source in the JBoss AS using the Teiid data source class "org.teiid.jdbc.TeiidDataSource". Make sure in the above XML you supply the correct DatabaseName, ServerName, port number and credentials that are specific to your deployment environment. Then restart the JBoss AS and access the above data source from the JNDI tree in your application with the specified JNDI name.

     

    You can also use Teiid's JDBC driver class "org.teiid.jdbc.TeiidDriver" to create a data source

     

    <datasources> 
      <local-tx-datasource> 
        <jndi-name>TEIID-DS</jndi-name> 
        <connection-url>jdbc:metamatrix:myVDB@mm://localhost:31000</connection-url> 
        <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>              
        <user-name>admin</user-name>
        <password>teiid</password>
        
        <!-- pool and other JBoss datasource properties -->
        <min-pool-size>5</min-pool-size> 
        <max-pool-size>10</max-pool-size>
      </local-tx-datasource> 
    </datasources>
    

     

     

    Teiid "Embedded" as Data Source

     

    Configuring the "Embedded" is no different than configuring "Server" other than providing a couple of different connection properties. In the embedded mode, there is no notion of server name and port number, however it requires the user to define where Teiid runtime is installed. It is recommended that Teiid Embedded only be deployed using File-Path profile when used with JBoss AS.

     

    1. Copy the "teiid-${version}-client.jar" file from "<teiid-install>/client" directory into "<jboss-install>/server/default/lib" directory.
    2. Create a "teiid-ds.xml" file in "<jboss-install>/server/default/deploy" directory.  The contents of the file should look like:

     

      <datasources>
      <xa-datasource>
        <jndi-name>TEIID-DS</jndi-name>
        <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
        <xa-datasource-property name="DatabaseName">myVDB</xa-datasource-property>
        <xa-datasource-property name="EmbeddedBootstrapFile">{teiid-install/deploy.properties}</xa-datasource-property> 
        <xa-datasource-property name="user">admin</xa-datasource-property> 
        <xa-datasource-property name="password">password</xa-datasource-property> 
        <track-connection-by-tx>true</track-connection-by-tx>
        <isSameRM-override-value>false</isSameRM-override-value>
        <no-tx-separate-pools />
    
        <!-- pool and other JBoss datasource properties -->
        <min-pool-size>5</min-pool-size> 
        <max-pool-size>10</max-pool-size>                
      </xa-datasource>        
      </datasources>
    

     

    Make sure you use the correct installation directory and credentials for a successful connection.

     

    You can also use Teiid's JDBC driver class "org.teiid.jdbc.TeiidDriver" to create a data source

     

    <datasources> 
      <local-tx-datasource> 
        <jndi-name>TEIID-DS</jndi-name> 
        <connection-url>jdbc:metamatrix:myVDB@{teiid-install/deploy.properties}</connection-url> 
        <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>              
        <user-name>admin</user-name>
        <password>teiid</password>
        
        <!-- pool and other JBoss datasource properties -->
        <min-pool-size>5</min-pool-size> 
        <max-pool-size>10</max-pool-size>
      </local-tx-datasource> 
    </datasources>