You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: x-pack/docs/en/sql/endpoints/jdbc.asciidoc
+129-4Lines changed: 129 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,133 @@ Elasticsearch's SQL jdbc driver is a rich, fully featured JDBC driver for Elasti
6
6
It is Type 4 driver, meaning it is a platform independent, stand-alone, Direct to Database,
7
7
pure Java driver that converts JDBC calls to Elasticsearch SQL.
8
8
9
-
// TODO add example of resolving the artifact in maven and gradle.
9
+
[float]
10
+
=== Installation
10
11
11
-
You can connect to it using the two APIs offered
12
-
by JDBC, namely `java.sql.Driver` and `DriverManager`:
12
+
The JDBC driver can be obtained either by downloading it from the https://www.elastic.co/downloads/jdbc-client[elastic.co] site or by using a http://maven.apache.org/[Maven]-compatible tool with the following dependency:
13
+
14
+
["source","xml",subs="attributes"]
15
+
----
16
+
<dependency>
17
+
<groupId>org.elasticsearch.plugin.jdbc</groupId>
18
+
<artifactId>jdbc</artifactId>
19
+
<version>{version}</version>
20
+
</dependency>
21
+
----
22
+
23
+
from `artifacts.elastic.co/maven` by adding it to the repositories list:
24
+
25
+
["source","xml",subs="attributes"]
26
+
----
27
+
<repositories>
28
+
<repository>
29
+
<id>elastic.co</id>
30
+
<url>https://artifacts.elastic.co/maven</url>
31
+
</repository>
32
+
</repositories>
33
+
----
34
+
35
+
[[jdbc-setup]]
36
+
[float]
37
+
=== Setup
38
+
39
+
The driver main class is `org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcDriver`. Note the driver
40
+
also implements the JDBC 4.0 +Service Provider+ mechanism meaning it is registerd automatically
41
+
as long as its available in the classpath.
42
+
43
+
Once registered, the driver expects the following syntax as an URL:
<2> type of HTTP connection to make - `http` (default) or `https`. Optional.
52
+
<3> host (`localhost` by default) and port (`9200` by default). Optional.
53
+
<4> prefix (empty by default). Typically used when hosting {es} under a certain path. Optional.
54
+
<5> Parameters for the JDBC driver. Empty by default. Optional.
55
+
56
+
The driver recognized the following parameters:
57
+
58
+
[[jdbc-cfg]]
59
+
[float]
60
+
===== Essential
61
+
62
+
`timezone` (default JVM timezone)::
63
+
Timezone used by the driver _per connection_ indicated by its `ID`.
64
+
*Highly* recommended to set it (to, say, `UTC`) as the JVM timezone can vary, is global for the entire JVM and can't be changed easily when running under a security manager.
65
+
66
+
[[jdbc-cfg-network]]
67
+
[float]
68
+
===== Network
69
+
70
+
`connect.timeout` (default 30s)::
71
+
Connection timeout (in seconds). That is the maximum amount of time waiting to make a connection to the server.
72
+
73
+
`network.timeout` (default 60s)::
74
+
Network timeout (in seconds). That is the maximum amount of time waiting for the network.
75
+
76
+
`page.timeout` (default 45s)::
77
+
Page timeout (in seconds). That is the maximum amount of time waiting for a page.
78
+
79
+
`page.size` (default 1000)::
80
+
Page size (in entries). The number of results returned per page by the server.
81
+
82
+
`query.timeout` (default 90s)::
83
+
Query timeout (in seconds). That is the maximum amount of time waiting for a query to return.
84
+
85
+
[[jdbc-cfg-auth]]
86
+
[float]
87
+
==== Basic Authentication
88
+
89
+
`user`:: Basic Authentication user name
90
+
91
+
`password`:: Basic Authentication password
92
+
93
+
[[jdbc-cfg-ssl]]
94
+
[float]
95
+
==== SSL
96
+
97
+
`ssl` (default false):: Enable SSL
98
+
99
+
`ssl.keystore.location`:: key store (if used) location
100
+
101
+
`ssl.keystore.pass`:: key store password
102
+
103
+
`ssl.keystore.type` (default `JKS`):: key store type. `PKCS12` is a common, alternative format
104
+
105
+
`ssl.truststore.location`:: trust store location
106
+
107
+
`ssl.truststore.pass`:: trust store password
108
+
109
+
`ssl.cert.allow.self.signed` (default `false`):: Whether or not to allow self signed certificates
110
+
111
+
`ssl.protocol`(default `TLS`):: SSL protocol to be used
0 commit comments