a blog for those who code

Friday 1 September 2017

How to Solve Total Requests made to DataSource is 0 in Solr

In this post we will be discussing about solving "Total Requests made to DataSource": "0" in Solr when connecting to Sql Server. Let's say I have created a new core and now I want to get some of my documents from the Sql Server to be indexed. For that I have to create a data config file which connects to my Sql Server and gets the desired data.

The connection to the DataSource is written like below

<dataSource type="JdbcDataSource"
            driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
            url="jdbc:sqlserver://server\instancename;databaseName=myDb"
            user="sa"
            password="myPassword"/>


Even though everything is correct you will get "Total Requests made to DataSource": "0", that's because you have not done an important step. That important step is to have a sqljdbc4.jar / sqljdbc6.jar (Download From : https://www.microsoft.com/en-us/download/details.aspx?id=11774) executable jar File inside your lib folder. The lib folder should be inside your Solr Installation directory and withing server folder. If you are using the latest version then you will need sqljdbc6.jar.

Once you are done with it, you will get the required results as you want.


Please like and share the CodingDefined.com blog if you find it useful and helpful.


No comments:

Post a Comment