I need to override the JdbcDataSource class getConnection() method to unlock Data direct driver.
When solr is executing the sql queries present in solr-data-config.xml inside solr cores, it is unable to execute the sql queries. It is failing with error "this driver is locked for use with embedded applications".
I could override the getConnection() method & unlock the driver by extending the JdbcDataSource class. But solr is not picking up my extended class. How to configure solr with extended JdbcDataSource.
I think the easiest way would be to create a new class that extends the old one, override getConnection()
call, include the class in a .jar-file, add the .jar-file to the libraries being loaded by Solr, then use the new name in your data source definition - dataSource type="NewAndImprovedJdbcDataSource"
.
You must the .jar file to the lib elements in solrconfig.xml
:
<lib dir="../../../<path>/" regex="my-library\.jar" />
You then reference the datasource in the data-config.xml file:
<dataSource name="<name>" type="YourCustomClass" />