Are you trying to do a JOIN on these two tables inside the DIH? On Tue, Jun 12, 2012 at 8:35 PM, Gora Mohanty <g...@mimirtech.com> wrote: > On 11 June 2012 21:29, Kay <uh.keer...@gmail.com> wrote: >> Hello, >> >> We have 2 MS SQL Server Databases which we wanted to index .But most of the >> columns in the Databases have the same names. For e.g. Both the DB’s have >> the columns First name ,Last name ,etc. > > It is not clear how you want to handle this: Should the records > from both databases be indexed into the same fields, e.g., > FirstName is always mapped to the Solr field FirstName for > both databases, or would you want that FirstName be mapped > to, say FirstName1, for the second database. > >> How can you index multiple Databases using single db-data-config file and >> one schema? >> >> Here is my data-config file >> <dataConfig> >> >> <dataSource type="JdbcDataSource" name="ds-2" >> driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" >> url="jdbc:sqlserver://localhost;DatabaseName= " user="" password="" /> >> <document name="PersonTable"> >> <entity dataSource="ds-2" name="People" query="SELECT >> BusinessEntityID,FirstName,LastName FROM dbo.PersonTable"> >> <field column="BusinessEntityID" >> name="BusinessEntityID" /> >> <field column="FirstName" name="FirstName" /> >> <field column="LastName" name="LastName" /> >> <field column="Department" name="Department" /> >> <field column="Age" name="Age" /> >> >> </entity> >> </document> >> >> <document name="person"> >> <entity dataSource="ds-1" name="People" query="SELECT >> BusinessEntityID,NameStyle,Title,FirstName,MiddleName,LastName,ModifiedDate >> FROM AdventureWorks.Person.Person"> >> <field column="BusinessEntityID" >> name="BusinessEntityID" /> >> <field column="NameStyle" name="NameStyle" /> >> <field column="Title" name="Title" /> >> <field column="FirstName" name="FirstName" /> >> <field column="MiddleName" name="MiddleName" /> >> <field column="LastName" name="LastName" /> >> <field column="ModifiedDate" name="ModifiedDate" /> >> </entity> >> </document> > > Never had occasion to try this, but there seems to be a problem > in the configuration here: > * You have defined datasource "ds-2" with > <dataSource type="JdbcDataSource" name="ds-2"...> > but there is no similar definition for "ds-1". You need to add > another entry at the top: > <dataSource type="JdbcDataSource" name="ds-1"...> > * I believe things should work after that, but if not you could try > remapping the field names in the second SELECT, and > correspondingly changing the field attributes for the second > entity, e.g., > <entity dataSource="ds-1" name="People" query="SELECT > BusinessEntityID as BusinessEntityID1...> > <field column="BusinessEntityID1" name="BusinessEntityID" /> > ... > > Regards, > Gora
-- Lance Norskog goks...@gmail.com