calling stored procedure from solr

前端 未结 2 1014
别那么骄傲
别那么骄傲 2020-12-09 13:00

I’m writing an application that searches by solr 3.4. To fill the index of solr I use the dataimporthandler and the com.microsoft.sqlserver.jdbc.SQLServerDriver class to get

相关标签:
2条回答
  • 2020-12-09 13:10

    You need to call stored procedure using following syntax

    <entity  name="PicturePath" processor="CachedSqlEntityProcessor" query="[h_getThumbnails] '4'"
    ">      </entity>
    
    0 讨论(0)
  • 2020-12-09 13:26

    For me it works like this:

    <dataSource name="ds-1" type="JdbcDataSource" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://10.0.2.47;databaseName=dbname" user="username" password="password" 
        responseBuffering="adaptive" batchSize="0" autoCommit="false"   /> 
    <entity name="item" dataSource="ds-1" query="[sp_StuffDataImportHandler]"></entity>
    

    But this only works if the stored procedure contains a simple SELECT query.

    If I declare some variables or temporrary tables before the query that will return the results then the import fails, giving me the same exception that you get.

    LATER EDIT

    I managed to make it work with more complex queries in the Stored Procedure. by adding SET NOCOUNT ON; at the beginning of the stored procedure.

    0 讨论(0)
提交回复
热议问题