soandos
soandos

Reputation: 5146

Connect Solr to database managed by SQL Management Studio

Currently I access my database instance via sql management studio, and the structure is something like:

SQL Server, database, database instance, table I care about.

I wish to use solr to index this data, but I cannot seem to connect to the server sucsessfully.

I have the following as my data-config.xml:

<dataConfig>
  <dataSource type="JdbcDataSource"
          driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
          url="jdbc:sqlserver://mySQLServer/DEV1"
          integratedSecurity="true"
          database="someData"
/>
<document>
    <entity name="myQuery" query="select * from temp_ip_solr_test"
            deltaQuery="select id from item where last_modified > '${dataimporter.last_index_time}'">
        <field column="NAME" name="name" />
    </entity>
</document>

Everything else is standard (though I did add the jdbc .jar file, and the sqlauth .dll file to the lib of the db core (that is the one that I am using), right out of the example-DIH example that is given with solr.

The error is: Exception while processing: myQuery document : SolrInputDocument[]:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select * from temp_ip_solr_test Processing Document # 1

The only warning is: SimplePropertiesWriter Unable to read: dataimport.properties

How can I make this work?

Solr version 4.3.

Upvotes: 0

Views: 2399

Answers (1)

Learner
Learner

Reputation: 2339

I think the issue is due to integrated security mechanism..

check this link for more details:http://lucene.472066.n3.nabble.com/Solr-SQL-Express-Integrated-Security-Unable-to-execute-query-td4035758.html

Try providing username and password explicitly and check if it works...

The below config file works fine with sql server. Make sure you are using the correct database / server name.

<dataConfig>  
      <dataSource type="JdbcDataSource" 
            driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
            url="jdbc:sqlserver://myserver;databaseName=mydb;responseBuffering=adaptive;selectMethod=cursor"   
            user="sa" 
            password="password"/>  
      <document>  
        <entity name="results" query="SELECT statements">  
          <field column="fielda" name="fielda"/>
    <field column="fieldb" name="fieldb"/>
    <field column="fieldc" name="fieldc"/>  
        </entity>  
      </document>  
    </dataConfig> 

Upvotes: 0

Related Questions