You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Walter Underwood <wu...@wunderwood.org> on 2012/01/20 23:48:02 UTC

Parameter for database host in DIH?

Is there a way to parameterize the JDBC URL in the data import handler?  I tried this, but it did not insert the value of the property. I'm running Solr 3.3.0.

  <dataSource driver="com.mysql.jdbc.Driver"
	      url="jdbc:mysql://${com.chegg.dbhost}/product"

wunder
--
Walter Underwood
wunder@wunderwood.org




Re: Parameter for database host in DIH?

Posted by Shawn Heisey <so...@elyograg.org>.
On 1/20/2012 5:01 PM, Walter Underwood wrote:
> Weird. I can make it work with a request parameter and $dataimporter.request.dbhost:
>
> http://localhost:8983/solr/textbooks/dataimport?command=full-import&dbhost=mydbhost
>
> Or I can make it work with a Java system property with no dots.
>
> But when I use a Java system property with internal dots, it doesn't work.

The way I have it, they are URL parameters. I have no idea how to do it 
with system properties.

Thanks,
Shawn


Re: Parameter for database host in DIH?

Posted by Chantal Ackermann <ch...@btelligent.de>.
Hi wunder,

for us, it works with internal dots when specifying the properties in
$SOLR_HOME/[core]/conf/solrcore.properties:

like this:
db.url=xxx
db.user=yyy
db.passwd=zzz

$SOLR_HOME/[core]/conf/data-config.xml:

<dataSource type="JdbcDataSource"
driver="oracle.jdbc.driver.OracleDriver" url="${db.url}"
user="${db.user}" password="${db.passwd}" batchSize="1000" />



Cheers,
Chantal

On Sat, 2012-01-21 at 01:01 +0100, Walter Underwood wrote:
> Weird. I can make it work with a request parameter and $dataimporter.request.dbhost:
> 
> http://localhost:8983/solr/textbooks/dataimport?command=full-import&dbhost=mydbhost
> 
> Or I can make it work with a Java system property with no dots.
> 
> But when I use a Java system property with internal dots, it doesn't work.
> 
> wunder
> 
> On Jan 20, 2012, at 3:53 PM, Walter Underwood wrote:
> 
> > On Jan 20, 2012, at 3:34 PM, Shawn Heisey wrote:
> > 
> >> On 1/20/2012 3:48 PM, Walter Underwood wrote:
> >>> Is there a way to parameterize the JDBC URL in the data import handler?  I tried this, but it did not insert the value of the property. I'm running Solr 3.3.0.
> >>> 
> >>>  <dataSource driver="com.mysql.jdbc.Driver"
> >>> 	      url="jdbc:mysql://${com.chegg.dbhost}/product"
> >> 
> >> Here's what I've got in mine.  I pass in dbHost and dbSchema parameters (along with a bunch of others that get used in the entity SQL statements) when starting DIH.
> >> 
> >> url="jdbc:mysql://${dataimporter.request.dbHost}:3306/${dataimporter.request.dbSchema}?zeroDateTimeBehavior=convertToNull"
> > 
> > 
> > Are those Java system properties? I didn't get a substitution when I ran: java -Dcom.chegg.dbhost=mydbhost
> > 
> > The resulting JDBC URL was jdbc:mysql:///product, so it replaced the variable with empty string. Odd.
> > 
> > wunder
> > --
> > Walter Underwood
> > wunder@wunderwood.org
> 
> 
> 
> 


Re: Parameter for database host in DIH?

Posted by Walter Underwood <wu...@wunderwood.org>.
Weird. I can make it work with a request parameter and $dataimporter.request.dbhost:

http://localhost:8983/solr/textbooks/dataimport?command=full-import&dbhost=mydbhost

Or I can make it work with a Java system property with no dots.

But when I use a Java system property with internal dots, it doesn't work.

wunder

On Jan 20, 2012, at 3:53 PM, Walter Underwood wrote:

> On Jan 20, 2012, at 3:34 PM, Shawn Heisey wrote:
> 
>> On 1/20/2012 3:48 PM, Walter Underwood wrote:
>>> Is there a way to parameterize the JDBC URL in the data import handler?  I tried this, but it did not insert the value of the property. I'm running Solr 3.3.0.
>>> 
>>>  <dataSource driver="com.mysql.jdbc.Driver"
>>> 	      url="jdbc:mysql://${com.chegg.dbhost}/product"
>> 
>> Here's what I've got in mine.  I pass in dbHost and dbSchema parameters (along with a bunch of others that get used in the entity SQL statements) when starting DIH.
>> 
>> url="jdbc:mysql://${dataimporter.request.dbHost}:3306/${dataimporter.request.dbSchema}?zeroDateTimeBehavior=convertToNull"
> 
> 
> Are those Java system properties? I didn't get a substitution when I ran: java -Dcom.chegg.dbhost=mydbhost
> 
> The resulting JDBC URL was jdbc:mysql:///product, so it replaced the variable with empty string. Odd.
> 
> wunder
> --
> Walter Underwood
> wunder@wunderwood.org





Re: Parameter for database host in DIH?

Posted by Walter Underwood <wu...@wunderwood.org>.
On Jan 20, 2012, at 3:34 PM, Shawn Heisey wrote:

> On 1/20/2012 3:48 PM, Walter Underwood wrote:
>> Is there a way to parameterize the JDBC URL in the data import handler?  I tried this, but it did not insert the value of the property. I'm running Solr 3.3.0.
>> 
>>   <dataSource driver="com.mysql.jdbc.Driver"
>> 	      url="jdbc:mysql://${com.chegg.dbhost}/product"
> 
> Here's what I've got in mine.  I pass in dbHost and dbSchema parameters (along with a bunch of others that get used in the entity SQL statements) when starting DIH.
> 
> url="jdbc:mysql://${dataimporter.request.dbHost}:3306/${dataimporter.request.dbSchema}?zeroDateTimeBehavior=convertToNull"


Are those Java system properties? I didn't get a substitution when I ran: java -Dcom.chegg.dbhost=mydbhost

The resulting JDBC URL was jdbc:mysql:///product, so it replaced the variable with empty string. Odd.

wunder
--
Walter Underwood
wunder@wunderwood.org




Re: Parameter for database host in DIH?

Posted by Shawn Heisey <el...@elyograg.org>.
On 1/20/2012 3:48 PM, Walter Underwood wrote:
> Is there a way to parameterize the JDBC URL in the data import handler?  I tried this, but it did not insert the value of the property. I'm running Solr 3.3.0.
>
>    <dataSource driver="com.mysql.jdbc.Driver"
> 	      url="jdbc:mysql://${com.chegg.dbhost}/product"
>
> wunder
> --
> Walter Underwood
> wunder@wunderwood.org
>
>
>

Here's what I've got in mine.  I pass in dbHost and dbSchema parameters 
(along with a bunch of others that get used in the entity SQL 
statements) when starting DIH.

url="jdbc:mysql://${dataimporter.request.dbHost}:3306/${dataimporter.request.dbSchema}?zeroDateTimeBehavior=convertToNull"


Thanks,
Shawn