# How to connect MS Sql server in windows?

**URL:** https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357
**Category:** Elasticsearch
**Created:** [November 13, 2017, 8:56am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357 "2017-11-13T08:56:01Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![divik](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@divik](https://discuss.elastic.co/u/divik)
#### Post date: [November 13, 2017, 8:56am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/1 "2017-11-13T08:56:01Z")

</div>

**First i have one doubt im using elasticsearch 5.6.3 and jdbc is elasticsearch-jdbc-2.3.3.1.. is it fine or is it wrong??**

Im using windows 7. and i installed elasticsearch 5.6.3 its shows

{ **strong text**  
"name" : "5uyIjly",  
"cluster\_name" : "elasticsearch",  
"cluster\_uuid" : "7RUbLqDQRJGLqq-sTYwtWg",  
"version" : {  
"number" : "5.6.3",  
"build\_hash" : "1a2f265",  
"build\_date" : "2017-10-06T20:33:39.012Z",  
"build\_snapshot" : false,  
"lucene\_version" : "6.6.1"  
},  
"tagline" : "You Know, for Search"  
}

after i copied jar file too.. after i run the command in bat file like

{  
"type": "jdbc",  
"jdbc": {  
"url" : "jdbc:sqlserver://192.169.23.1/div2011;instanceName=SQLEXPRESS;databaseName=esctt",^  
"user": "well",  
"password": "well",  
"sql": "select Top 10 \* from tbl\_name",  
"treat\_binary\_as\_string": true,  
"elasticsearch": {  
"cluster": "elasticsearch",  
"host": "localhost",  
"port": 9200  
},  
"index": "record",  
"type": "record"  
}  
}

when im execute its shows

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>mssql-simple-example.bat

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>{  
'{' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"type": "jdbc",  
'"type":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"jdbc": {  
'"jdbc":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"url" : "jdbc:sqlserver://  
192.169.23.1/div2011;instanceName=SQLEXPRESS;databaseName=esctt",  
"user": "well",  
'"url"' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"password": "well",  
'"password":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"sql": "select Top 10 \* fr  
om tbl\_name",  
'"sql":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"treat\_binary\_as\_string":  
true,  
'"treat\_binary\_as\_string":' is not recognized as an internal or external command  
,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"elasticsearch": {  
'"elasticsearch":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"cluster": "elasticsearch"  
,  
'"cluster":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"host": "localhost",  
'"host":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"port": 9200  
'"port":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>},  
'}' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"index": "record",  
'"index":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>"type": "record"  
'"type":' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>}  
'}' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>}  
'}' is not recognized as an internal or external command,  
operable program or batch file.

C:\elasticsearch-5.6.3\elasticsearch-jdbc-2.3.3.1\bin\>

**please help this**

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 13, 2017, 9:32am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/2 "2017-11-13T09:32:25Z")

</div>

First read

> [@Problem in connecting to SQL Server using JDBC](https://discuss.elastic.co/t/problem-in-connecting-to-sql-server-using-jdbc/107309/2):
>
> Looking at the matrix that @jprante wrote at [https://github.com/jprante/elasticsearch-jdbc](https://github.com/jprante/elasticsearch-jdbc) and some issues like It seems like the project is not compatible with 5.x. There is a 5.0 branch though: [https://github.com/jprante/elasticsearch-jdbc/tree/5.0](https://github.com/jprante/elasticsearch-jdbc/tree/5.0) Unsure what is its state.

The problem you have is something else I think but I prefer that you know the limits before solving something useless.

---

<div class="post-metadata">

### Author: ![divik](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@divik](https://discuss.elastic.co/u/divik)
#### Post date: [November 13, 2017, 10:11am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/3 "2017-11-13T10:11:52Z")

</div>

k thank u

---

<div class="post-metadata">

### Author: ![divik](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@divik](https://discuss.elastic.co/u/divik)
#### Post date: [November 14, 2017, 6:59am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/4 "2017-11-14T06:59:43Z")

</div>

I followed this [http://hintdesk.com/how-to-connect-elasticsearch-to-ms-sql-server/](http://hintdesk.com/how-to-connect-elasticsearch-to-ms-sql-server/)

**my batfile:**

@echo off  
set DIR=%~dp0  
set LIB=%DIR%..\lib\*  
set BIN=%DIR%..\bin

REM ???  
echo {^  
“type” : “jdbc”,^  
“jdbc” : {^  
“url” : “jdbc:sqlserver://192.14.541/Ssme2012;instanceName=SQLEXPRESS;databaseName=ESHUN”,^  
“user” : “ghud”,^  
“password” : “ghud”,^  
“sql” : “select Top 10 Name, Area, City from details.Person”,^  
“treat\_binary\_as\_string” : true,^  
“elasticsearch” : {^  
“cluster” : “elasticsearch”,^  
“host” : “localhost”,^  
“port” : 9200^  
},^  
“index” : “person”,^  
“type” : “person”^  
}^  
}^ | “%JAVA\_HOME%\bin\java” -cp “%LIB%” -Dlog4j.configurationFile=”%BIN%\log4j2.xml” “org.xbib.tools.Runner” “org.xbib.tools.JDBCImporter”  
}^ | “%JAVA\_HOME%\bin\java” -cp “%LIB%” -Dlog4j.configurationFile=”%BIN%\log4j2.xml” “org.xbib.tools.Runner” “org.xbib.tools.JDBCImporter”

but its not working can you please help me for this solution

i got this error:

c:\elasticsearch-2.3.3\elasticsearch-jdbc-2.3.3.1\bin\>}, "index" : "person",  
pe" : "person" } } | "C:\Program Files\Java\jdk1.8.0\_40\bin\java"  
p "c:\elasticsearch-2.3.3\elasticsearch-jdbc-2.3.3.1\bin..\lib\*" -Dlog4j.co  
gurationFile="c:\elasticsearch-2.3.3\elasticsearch-jdbc-2.3.3.1\bin..\bin\lo  
2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"  
'}' is not recognized as an internal or external command,  
operable program or batch file.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 14, 2017, 7:27am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/5 "2017-11-14T07:27:45Z")

</div>

I don't know. May be ask on [https://github.com/jprante/elasticsearch-jdbc](https://github.com/jprante/elasticsearch-jdbc) ?

---

<div class="post-metadata">

### Author: ![divik](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@divik](https://discuss.elastic.co/u/divik)
#### Post date: [November 14, 2017, 7:30am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/6 "2017-11-14T07:30:05Z")

</div>

okay thank you for quick response

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 12, 2017, 7:30am UTC](https://discuss.elastic.co/t/how-to-connect-ms-sql-server-in-windows/107357/7 "2017-12-12T07:30:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
