# java.sql.SQLException: Server sent bad type \[illegal\_argument\_exception\]. Original type was \[request \[/\_xpack/sql\] contains unrecognized parameter

**URL:** https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190
**Category:** Elasticsearch
**Created:** [July 30, 2018, 1:54pm UTC](https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190 "2018-07-30T13:54:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agrawal/32/33850_2.png) [@agrawal](https://discuss.elastic.co/u/agrawal)
#### Post date: [July 30, 2018, 1:54pm UTC](https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190/1 "2018-07-30T13:54:03Z")

</div>

Hi,

I am indexing some data and trying to fetch out using JDBCDataSource connection.  
ES server version: 6.2.4 ( Docker container)  
ES elasticsearch.plugin: 6.3.0  
ES rest-high-level-client: 6.3.2

Getting an error:  
java.sql.SQLException: Server sent bad type [illegal\_argument\_exception]. Original type was [request [/\_xpack/sql] contains unrecognized parameter: [mode]]. [java.lang.IllegalArgumentException: request [/\_xpack/sql] contains unrecognized parameter: [mode]  
at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:92)...

@Test

```
public void testBlogSolution() throws IOException, SQLException {
	RestHighLevelClient client = new RestHighLevelClient(
            RestClient.builder(new HttpHost("localhost", 9200, "http"))
                .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
                    public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {

                        return requestConfigBuilder.setConnectTimeout(5000)
                                .setSocketTimeout(100000);
                    }	
                })

        .setMaxRetryTimeoutMillis(100000)
    );
	String jsonObject = "{\"age\":10,\"dateOfBirth\":1471466076564,"
		      +"\"fullName\":\"John Doe\"}";

```

Map\<String,String\> map = new HashMap\<String, String\>();  
map.put("name","ajay");  
map.put("salary","12000");  
map.put("teamname","development");  
String str = "{"age":10,"dateOfBirth":1471466076564,"  
+""fullName":"John Doe"}";

IndexRequest indexRequest = new IndexRequest("nindex", "nitesh");

indexRequest.source(str, XContentType.JSON);  
IndexResponse indexResponse = client.index(indexRequest);  
System.out.println(indexResponse.getIndex());

//Fetching data

JdbcDataSource dataSource = new JdbcDataSource();  
String address = "jdbc:es://" + "localhost:9200";  
dataSource.setUrl(address);  
Properties connectionProperties = new Properties();  
Connection connection = DriverManager.getConnection(address, connectionProperties);

//Properties properties = new Properties();  
[//properties.put](https://properties.put)("user", "test\_admin");  
[//properties.put](https://properties.put)("password", "x-pack-test-password");

try {  
Statement statement = connection.createStatement();  
ResultSet results = statement.executeQuery(  
"");

```
System.out.println(results.getString(1));

```

} catch (SQLException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}

```
}
```

---

<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: [July 30, 2018, 2:15pm UTC](https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190/2 "2018-07-30T14:15:32Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.

> ES server version: 6.2.4 ( Docker container)

You need elasticsearch server 6.3 to have access to this feature.

---

<div class="post-metadata">

### Author: ![agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agrawal/32/33850_2.png) [@agrawal](https://discuss.elastic.co/u/agrawal)
#### Post date: [July 31, 2018, 4:31am UTC](https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190/3 "2018-07-31T04:31:00Z")

</div>

Thanks David. its working now, however another issue popup saying "current license is non-compliant for [jdbc]"

I took note on formatting for next issue.

Thanks  
Nitesh Agrawal

---

<div class="post-metadata">

### Author: ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)
#### Post date: [July 31, 2018, 4:45am UTC](https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190/4 "2018-07-31T04:45:16Z")

</div>

Hi @agrawal,  
Indeed, the JDBC driver is a Platinum feature. Have a look [here](https://www.elastic.co/subscriptions) (and expand `Management & Tooling` section) for details about this.

Andrei

---

<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: [August 28, 2018, 4:45am UTC](https://discuss.elastic.co/t/java-sql-sqlexception-server-sent-bad-type-illegal-argument-exception-original-type-was-request-xpack-sql-contains-unrecognized-parameter/142190/5 "2018-08-28T04:45:33Z")

</div>

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