Skip to main content

Expose Excel Data as OData feed using Teiid

For that matter you can expose any data source that is supported by Teiid through its translators as OData service. You can convert
  • Relational databases
  • XML, JSON, CSV files
  • Web Services 
  • Sales Force
  • Excel documents
sources, or write your on top of your specific source.

Teiid added support for exposing its virtual database (VDB) as OData service without any additional work. Create a virtual database with your required sources and create any additional views and deploy in the the JBoss EAP 6.1 server, that has Teiid 8.3 or greater installed.  See https://docs.jboss.org/author/display/teiid84final/OData+Support for more information.

So, lets build a simple example of exposing the Excel Sheet. Teiid accesses Excel sheets via JDBC-ODBC bridge, and Windows OS provides a ODBC driver for Excel documents. 

Edit the standalone-teiid.xml, and create Connection Factory
 

    
        jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};Dbq=c:\ODBC\ExcelData.xls
        odbc
        TRANSACTION_NONE
        
            false
            false
            FailingConnectionOnly
        
        
            {user}
            {password}
        
         
    
        
         sun.jdbc.odbc.JdbcOdbcDriver
     
     



Now create VDB, using the excel as the source
 


    
    
        
    



save the above as "odbc-vdb.xml" and deploy into Teiid Server. See https://docs.jboss.org/author/display/TEIID/Deploying+VDBs for deployment instructions.  Make sure your VDB deployed in "ACTIVE" state.

Now, you can access your Excel data using OData API. Either using the your Web Browser or favorite OData client, go to 

 
     http://:/odata/odbc/excel.Sheet1
For more complete information about OData API see https://docs.jboss.org/author/display/TEIID/OData+Support

Thanks
Ramesh..

Comments

  1. I tried to do this with a test Excel file but when I started ran standalone.sh, I got this error:
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.1: Element 'property' must have no character or element information item [children], because the type's content type is empty.

    java version "1.6.0_37"
    JBoss EAP 6.1
    Teiid Server 8.4

    ReplyDelete
  2. Try querying your Excel based vdb using any SQL client such as SquirreL and make sure it is returning results before you use the OData interface, that should give you correct error.

    ReplyDelete

Post a Comment

Popular posts from this blog

Teiid 8.11 Beta1 and 8.10.1 Released

Teiid 8.11 Beta1 is now available from the  downloads  and maven.  Feature highlights since Alpha2 include: TEIID-3434 More caching control over ttls in the result set cache down to the schema/table level. TEIID-3412 MS Access support via the UCanAccess driver. The UCanAccess support is necessary for those running on Java 1.8 as the JDBC ODBC bridge has been removed from the JRE. The waiting continues on EAP 6.4 Alpha1 - it still should be available shortly and should be the platform target for Teiid 8.11 Beta2. Of course, let us know if you find any issues with these early releases.  There's still plenty of time to get fixes into the final release. Teiid 8.10.1 is also available.  It addresses 5 important issues discovered since 8.10 was released: [ TEIID-3409 ] - PostgreSQLExecutionFactory TranslatorProperty annotation in wrong place [ TEIID-3437 ] - Inconsistencies with row count handling [ TEIID-3438 ] - Null value returned from BlobImpl

Tech Tip: Teiid SQL Language MAKEDEP Hint Explained

In this article I will explain what a MAKEDEP hint is, how and when, why it should be used in Teiid. What: MAKEDEP is query hint.  When a query hint is defined in the SQL query it influences the Teiid query planner to optimize the query in a way that is driven by the user. MAKEDEP means "make this as a dependent join". What is a Dependent Join? For example if we have query like: SELECT * FROM X INNER JOIN Y ON X.PK = Y.FK Where the data for X, and Y are coming from two different sources like Oracle and WebService in Teiid, so in relational algebra you can represent above query as Here the result tuples from node X and node Y are being simultaneously fetched by Teiid query engine, then it joins the both the results inside Teiid engine based on the specified X.PK = Y.PK condition and returns the filtered resulted to the user. simple.. Now, what if, if X table has 5 rows and Y table has 100K rows? In order to do the JOIN naively Teiid need sto read all the 5

Teiid 8.13.3 Released

Teiid 8.13.3 is now  available .  In total 8.13.3 addresses 10 issues since 8.13.2: [ TEIID-4028 ] - adding salesforce-34 resource adapter does not work through the cli [ TEIID-4066 ] - Odata translator ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl [ TEIID-4070 ] - Issues with resource adapters with api modules in wildfly [ TEIID-4089 ] - Teiid JDBC driver does not reset the update count when calling getMoreResults(int) [ TEIID-4093 ] - OData authentication fails with NPE when gss-pattern related properties are included in VDB [ TEIID-4096 ] - AssertionError with independent side of a dependent join that has an ordered limit [ TEIID-3050 ] - allow for more incremental insert with iterator [ TEIID-4075 ] - Netezza translator to support common table expressions [ TEIID-4098 ] - Always preserve columns order in google spreadsheets models [ TEIID-4046 ] - OData - $skip is beeing ignor