![]() |
VOOZH | about |
The Apache Solr platform is a popular, blazing-fast, open source enterprise search solution built on Apache Lucene.
Apache Solr is equipped with the Data Import Handler (DIH), which can import data from databases and, XML, CSV, and JSON files. When paired with the CData JDBC Driver for JDBC-ODBC Bridge, you can easily import JDBC-ODBC Bridge data to Apache Solr. In this article, we show step-by-step how to use CData JDBC Driver in Apache Solr Data Import Handler and import JDBC-ODBC Bridge data for use in enterprise search.
> solr create -c CDataCoreFor this article, Solr is running as a standalone instance in the local environment and you can access the core at this URL: http://localhost:8983/solr/#/CDataCore/core-overview
JDBCODBCUniqueKeyπ Define schema in Solr for JDBC-ODBC Bridge data.
Now we are ready to use JDBC-ODBC Bridge data in Solr.
In this section, we walk through configuring the Data Import Handler.
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">solr-data-config.xml</str>
</lst>
</requestHandler>
<dataConfig>
<dataSource driver="cdata.jdbc.jdbcodbc.JDBCODBCDriver" url="jdbc:jdbcodbc:Driver={ODBC_Driver_Name};Driver_Property1=Driver_Value1;Driver_Property2=Driver_Value2;...">
</dataSource>
<document>
<entity name="Account"
query="SELECT Id,JDBCODBCColumn1,JDBCODBCColumn2,JDBCODBCColumn3,JDBCODBCColumn4,JDBCODBCColumn5,JDBCODBCColumn6,JDBCODBCColumn7,LastModifiedDate FROM Account"
deltaQuery="SELECT Id FROM Account where LastModifiedDate >= '${dataimporter.last_index_time}'"
deltaImportQuery="SELECT Id,JDBCODBCColumn1,JDBCODBCColumn2,JDBCODBCColumn3,JDBCODBCColumn4,JDBCODBCColumn5,JDBCODBCColumn6,JDBCODBCColumn7,LastModifiedDate FROM Account where Id=${dataimporter.delta.Id}">
<field column="Id" name="Id" ></field>
<field column="JDBCODBCColumn1" name="JDBCODBCColumn1" ></field>
<field column="JDBCODBCColumn2" name="JDBCODBCColumn2" ></field>
<field column="JDBCODBCColumn3" name="JDBCODBCColumn3" ></field>
<field column="JDBCODBCColumn4" name="JDBCODBCColumn4" ></field>
<field column="JDBCODBCColumn5" name="JDBCODBCColumn5" ></field>
<field column="JDBCODBCColumn6" name="JDBCODBCColumn6" ></field>
<field column="JDBCODBCColumn7" name="JDBCODBCColumn7" ></field>
<field column="LastModifiedDate" name="LastModifiedDate" ></field>
</entity>
</document>
</dataConfig>> solr stop -all > solr start
Using the CData JDBC Driver for JDBC-ODBC Bridge you are able to create an automated import of JDBC-ODBC Bridge data into Apache Solr. Download a free, 30 day trial of any of the hundreds of CData JDBC Drivers and get started today.
Download a free trial of the JDBC-ODBC Bridge to get started:
Download NowLearn more:
π ODBC Connectivity from Java IconThe JDBC-ODBC Bridge provides JDBC access from any Java App to ODBC data sources on Windows, Linux and Mac. Whether your organization uses Java-based tools for reporting and analytics, or builds custom Java solutions, the CData JDBC-ODBC Bridge provides an easy way to connect with any ODBC data source.