Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

2.4. Define a Connection

Extend the org.teiid.resource.spi.BasicConnection class, and provide an implementation based on your access of the Connection object in your translator. If your connection is stateful, override the isAlive() and cleanup() methods with suitable implementations. These methods are called to check if a connection is stale and needs flushing from the connection pool by the application server.
public class MyConnection extends BasicConnection 
{
   public void doSomeOperation(Command command)
   {
      // do some operation with requesting application..
      // This is method you use in the Translator, you should know
      // what need to be done here for your source..
   }
     
   @Override
   public boolean isAlive() 
   {
      return true;
   }
   
   @Override
   public void cleanUp() 
   {
         
   }

   public void close() throws ResourceException 
   {

   }
}