Found a solution, if anyone else has this issue the solution was:
1. (If its not already there) Move the <datasource> part from
db-data-config.xml into the requesthandler for data import (<requestHandler
name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">) in
solrconfig.xml.
2. Modify the strings for the connection/user/password so the request handler
looks like this:
<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">db-data-config.xml</str>
<lst name="datasource">
<str
name="driver">com.microsoft.sqlserver.jdbc.SQLServerDriver</str>
<str
name="url">jdbc:sqlserver://${sqlserver:unset}\${sqlinstance:unset};databaseName=${sqldatabase:unset}</str>
<str name="user">${sqluser:unset}</str>
<str name="password">${qlpassword:unset}</str>
</lst>
</lst>
</requestHandler>
This makes it possible to have those ': \ = ;' characters in the jdbcurl and
just set the:
sqlserver
sqlinstance
sqldatabase
parts as core.properties.
-----Original Message-----
From: Jens Hittenkofer <[email protected]>
Sent: den 13 november 2020 15:25
To: [email protected]
Subject: Escape characters for core.properties User-Defined Properties
Hi,
Im using SolrCloud (Solr 6.6.6 together with Zookeeper) . I want to use the
same template/configuration for multiple Solr cores. Each core should use its
own connectionstring for the data-import-handler (MSSQL). What im trying to do
is to add the connectionstring as a User-Defined Property in the
core.properties file while creating the core to reference in the
data-import-handler, as such:
http://XXXXX:8983/solr/admin/collections?action=CREATE&name=TESTCORE&numShards=1&maxShardsPerNode=2&replicationFactor=3&collection.configName=TESTCORECONFIG&property.connectionstring=sqlserver://server.domain\instance;databaseName=SOMEDBNAME
But when I add the connectionstring like above I get escape an character ('\')
before ':', '=' and '\'. So the connectionstring in core.properties looks like
this: 'sqlserver\://server.domain\\instance;databaseName\=SOMEDBNAME'
I've tried to urlencode and escape the characters in different ways (also read
documentation and googled ofc).
Is there anyway to do this or should I go for a totally different approach
somehow?
Thanks