title: How to fetch data from database in solr
body: <p>I wanted to fetch data from database for indexing through solr. 
  my db-data-config.xml is :</p>
  
  <pre><code>&lt;dataConfig&gt;
      &lt;dataSource type="JdbcDataSource" driver="org.gjt.mm.mysql.Driver" url="jdbc:mysql://192.168.1.9:3306/angara" user="root" password="ampliflex" /&gt;
      &lt;document&gt;
                   &lt;entity name="tdiamonds" query="select UID_PK from tdiamonds"
              &lt;field column="UID_PK" name="name" /&gt;
            &lt;/entity&gt;
      &lt;/document&gt; &lt;/dataConfig&gt;
  </code></pre>
  
  <p>and i did necessary changes in schema.xml  and solrconfig.xml, but still i am getting some exception. and its not clear to me what it is all about, please give me some suggestion. the exceptions i am geeting are:</p>
  
  <blockquote>
    <p>org.apache.solr.handler.dataimport.DataImportHandlerException:
    Exception occurred while initializing
    context   at
    org.apache.solr.handler.dataimport.DataImporter.loadDataConfig(DataImporter.java:190)
      at
    org.apache.solr.handler.dataimport.DataImporter.(DataImporter.java:101)
      at
    org.apache.solr.handler.dataimport.DataImportHandler.inform(DataImportHandler.java:113)
      at
    org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:486)
      at
    org.apache.solr.core.SolrCore.(SolrCore.java:588)
      at
    org.apache.solr.core.CoreContainer.create(CoreContainer.java:428)
      at
    org.apache.solr.core.CoreContainer.load(CoreContainer.java:278)
      at
    org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:117)
      at
    org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:83)
      at
    org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
      at
    org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
      at
    org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:594)
      at
    org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
      at
    org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
      at
    org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
      at
    org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
      at
    org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
      at
    org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
      at
    org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
      at
    org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
      at
    org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
      at
    org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
      at
    org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
      at
    org.mortbay.jetty.Server.doStart(Server.java:210)
      at
    org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
      at
    org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:929)
      at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
    Source)   at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
    Source)   at
    java.lang.reflect.Method.invoke(Unknown
    Source)   at
    org.mortbay.start.Main.invokeMain(Main.java:183)
      at
    org.mortbay.start.Main.start(Main.java:497)
      at
    org.mortbay.start.Main.main(Main.java:115)
    Caused by:
    org.xml.sax.SAXParseException: Element
    type "entity" must be followed by
    either attribute specifications, ">"
    or "/>".  at
    com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown
    Source)   at
    com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown
    Source)   at
    org.apache.solr.handler.dataimport.DataImporter.loadDataConfig(DataImporter.java:178)</p>
  </blockquote>