1

When I try to access my access db with solr DIH it gives me an error:

    java.sql.SQLException: Invalid Fetch Size

My configuration and requesthandler and dataconfig. Im using a 2007 access db from a file. I already changed my java version to 32bit to communicate with the 32bit driver. So I don't think its related to that.

<dataConfig>
  <dataSource type="JdbcDataSource" 
              driver="sun.jdbc.odbc.JdbcOdbcDriver"
              url="jdbc:odbc:test"
              batchSize="-1"
                convertType="true"/>
  <document>
    <entity name="id" 
            query="select ID from myTest">
    </entity>
  </document>
</dataConfig>

  <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">data-config.xml</str>
    </lst>
  </requestHandler>
DavidVdd
  • 1,020
  • 3
  • 17
  • 40
  • 1
    batchSize="-1" i think would be it. Try changing it to "1" because a -1 sets it to fetch 500 rows in one batch per default and some drivers can't handle that. – Henrik Andersson Nov 15 '12 at 14:15
  • I've set it to 0 and it seems to work ok for now. But I'm getting other errors after adding around 60000 docs it stopts :( – DavidVdd Nov 15 '12 at 15:01

1 Answers1

2

Try setting your batchSize="-1" to batchSize="1" or 0. Setting the batchSize to -1 is the default value and thusly the DIH sets it to the default of 500 and some drivers can't handle that.

You can read more here DIH FAQ

As to your getting some other error, can you please post what that error is?

Henrik Andersson
  • 45,354
  • 16
  • 98
  • 92
  • java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid transaction state. I only got it after adding around 60000 documents. – DavidVdd Nov 16 '12 at 09:06
  • After adding or reading? If you're reading from the MS Access file you have encountered some form of lock on the transaction so try closing it inbetween reads. – Henrik Andersson Nov 16 '12 at 10:05
  • I had to set a non-0 batch size (e.g. 100), my setup wouldn't recognize `-1` or `0`. – brichins Jul 14 '23 at 15:53