title: Solr reports: "Connection refused" when running import
body: <p>I am running a database that acts as the source for data to import into Solr. When I run the command: curl "http://localhost:8983/solr/dataimport?command=full-import&amp;commit=true", the commit fails and the instance does a rollback. Can you help me to figure this out?</p>
  
  <p><strong>Here is the exception stack:</strong></p>
  
  <blockquote>
  <pre><code>    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.DataImporter doFullImport
      INFO: Starting Full Import
      Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrCore execute
      INFO: [] webapp=/solr path=/dataimport params={command=full-import&amp;commit=true} status=0 QTime=0 
      Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
      INFO: Read dataimport.properties
      Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 deleteAll
      INFO: [] REMOVING ALL DOCUMENTS FROM INDEX
      Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrDeletionPolicy onInit
      INFO: SolrDeletionPolicy.onInit: commits:num=1
        commit{dir=/private/var/www/html/internsolr/solr/example/solr/data/index,segFN=segments_21,version=1320251100987,generation=73,filenames=[segments_21]
      Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrDeletionPolicy updateCommits
      INFO: newest commit = 1320251100987
      Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
      INFO: Creating a connection for entity id with URL: jdbc:mysql://localhost:3306/internshipsearch
      Jan 27, 2012 4:02:32 PM org.apache.solr.common.SolrException log
      SEVERE: Exception while processing: id document : SolrInputDocument[{}]:org.apache.solr.handler.dataimport.DataImportHandlerException:
  </code></pre>
    
    <p>Unable to execute query: select respondentid,<br>
    first_name,                           last_name,<br>
    cmc_email_address,                           graduation_year,<br>
    first_major,                           additional_major,<br>
    sequence,                           other_major,<br>
    organization_name,                           organization_website,<br>
    organization_desc,                           industry,<br>
    job_title,                           department,<br>
    city,                           state,<br>
    country,                           region,<br>
    internship_paid,                           hourly_salary,<br>
    year_undertaken,                           recommend_again,<br>
    employer_supervisor,                           employer_phone,<br>
    employer_email,                           not_recommended_desc,<br>
    full_time_offer,                           full_time_accept,<br>
    attend_summer_classes,<br>
    summer_classes_institution,<br>
    summer_classes_desc,                           summer_travel,<br>
    summer_travel_city,                           summer_travel_state,<br>
    summer_travel_country,<br>
    summer_other_activity,<br>
    summer_other_activity_desc,                           how_discovered, 
    doe_start_month,                           doe_start_day,<br>
    doe_end_month,                           doe_end_day             from
    interndata Processing Document # 1
              at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
              at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.(JdbcDataSource.java:253)
              at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
              at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
              at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
              at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
              at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
              at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
              at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
              at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
              at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
              at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
              at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
            Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: </p>
  
  <pre><code>    ** BEGIN NESTED EXCEPTION ** 
  
      java.net.SocketException
      MESSAGE: java.net.ConnectException: Connection refused
  
      STACKTRACE:
  
      java.net.SocketException: java.net.ConnectException: Connection refused
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
        at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:276)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
        at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1531)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
        at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
        at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.&lt;init&gt;(JdbcDataSource.java:240)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
        at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
        at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
        at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
        at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
        at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
        at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
        at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
        at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
        at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
  
  
      ** END NESTED EXCEPTION **
  
  
  
      Last packet sent to the server was 0 ms ago.
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
        at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1531)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
        at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
        at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.&lt;init&gt;(JdbcDataSource.java:240)
        ... 11 more
  
      Jan 27, 2012 4:02:32 PM org.apache.solr.common.SolrException log
      SEVERE: Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException:
  </code></pre>
    
    <p>Unable to execute query: select respondentid,<br>
    first_name,                           last_name,<br>
    cmc_email_address,                           graduation_year,<br>
    first_major,                           additional_major,<br>
    sequence,                           other_major,<br>
    organization_name,                           organization_website,<br>
    organization_desc,                           industry,<br>
    job_title,                           department,<br>
    city,                           state,<br>
    country,                           region,<br>
    internship_paid,                           hourly_salary,<br>
    year_undertaken,                           recommend_again,<br>
    employer_supervisor,                           employer_phone,<br>
    employer_email,                           not_recommended_desc,<br>
    full_time_offer,                           full_time_accept,<br>
    attend_summer_classes,<br>
    summer_classes_institution,<br>
    summer_classes_desc,                           summer_travel,<br>
    summer_travel_city,                           summer_travel_state,<br>
    summer_travel_country,<br>
    summer_other_activity,<br>
    summer_other_activity_desc,                           how_discovered, 
    doe_start_month,                           doe_start_day,<br>
    doe_end_month,                           doe_end_day             from
    interndata Processing Document # 1
              at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
              at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.(JdbcDataSource.java:253)
              at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
              at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
              at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
              at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
              at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
              at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
              at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
              at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
              at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
              at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
              at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
            Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: </p>
  
  <pre><code>    ** BEGIN NESTED EXCEPTION ** 
  
      java.net.SocketException
      MESSAGE: java.net.ConnectException: Connection refused
  
      STACKTRACE:
  
      java.net.SocketException: java.net.ConnectException: Connection refused
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
        at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:276)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
        at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1531)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
        at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
        at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.&lt;init&gt;(JdbcDataSource.java:240)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
        at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
        at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
        at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
        at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
        at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
        at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
        at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
        at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
        at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
  
  
      ** END NESTED EXCEPTION **
  
  
  
      Last packet sent to the server was 0 ms ago.
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
        at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1531)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
        at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
        at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
        at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
        at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.&lt;init&gt;(JdbcDataSource.java:240)
        ... 11 more
  
      Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 rollback
      INFO: start rollback
      Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 rollback
      INFO: end_rollback
  </code></pre>
  </blockquote>