If your using a DIH for SQL server you can configure it however you want. Here 
is a
snippet of my code. Note the Driver you need to grab from sourcenet.

<dataConfig>
 <dataSource type="JdbcDataSource"
      name="bleh"
      driver="net.sourceforge.jtds.jdbc.Driver"
      
url="jdbc:jtds:sqlserver://localhost;databaseName=bleh;responseBuffering=adaptive;"
      user="test"
      password="test"
      onError="skip"/>
 <document>
   <entity name="Entities"
           dataSource="JIEE"
           transformer="DateFormatTransformer"
    query = "SELECT
     EntityUID AS id,
     EntityType AS cat,
     EntityUIDParent AS pid,
     subject AS subject,
     summary AS summary,
     DateCreated AS eventdate,
     Latitude AS lat,
     Longitude AS lng,
     Type AS jtype,
     SupportCategory AS supcat,
     Cause AS cause,
     Status AS status,
     Urgency AS urgency,
     Priority AS priority,
     Coordinate AS coords
     FROM dbo.JIEESearchIndex">

     <field column="id" name="id" />
     <field column="cat" name="cat" />
     <field column="subject" name="subject" />
     <field column="summary" name="summary" />
     <field column="eventdate" name="eventdate"
dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"/>
     <field column="lat" name="lat" />
     <field column="lng" name="lng" />
     <field column="coords" name="coords" />
     <field column="jtype" name="jtype" />
     <field column="supcat" name="supcat" />
     <field column="cause" name="cause" />
     <field column="status" name="status" />
     <field column="urgency" name="
> 
> 
> 
> 
> 
> 
> 
> 
> 

Adam

Sent from my iPhone

On Feb 17, 2011, at 1:12 AM, Grijesh <pintu.grij...@gmail.com> wrote:

> 
> Use a fielddatasource for reading field from database and then use
> xpathentityprocessor .Field datasource will give you the stream that is
> needed by xpathentity processor.Bellow is the example dih configuration
> code.
> 
> <?xml version="1.0"?>
> <dataConfig>
>  <dataSource type="JdbcDataSource" 
>  driver="oracle.jdbc.driver.OracleDriver" 
>  url="jdbc:oracle:thin:@localhost:1521:xe" 
>  user="user" 
>  password="password"
>  name="ds"/>
>  <dataSource name="fieldSource" type="FieldReaderDataSource" />
>  <document>
>    <entity name="clobxml" dataSource="ds" query="select * from tableXX"
> transformer="ClobTransformer">
>      <field column="ID" name="id" />
>      <field column="SUPPLIER_APPROVALS" name="supplier_approvals"
> clob="true"/>
>            <entity name="xmlread" dataSource="fieldSource"
> processor="XPathEntityProcessor" forEach="/suppliers/supplier"
> dataField="clobxml.SUPPLIER_APPROVALS" onError="continue" >
>              <field column="supplier_name" xpath="/suppliers/supplier/name"
> />
>              <field column="supplier_id" xpath="/suppliers/supplier/id" />
>            </entity>
>    </entity>
>  </document>
> </dataConfig>
> 
> 
> -----
> Thanx:
> Grijesh
> http://lucidimagination.com
> -- 
> View this message in context: 
> http://lucene.472066.n3.nabble.com/How-to-use-XML-parser-in-DIH-for-a-database-tp2508015p2515910.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to