OmniSciDB  c07336695a
OmniSciConnection.java
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.omnisci.jdbc;
17 
19 import com.mapd.thrift.server.MapD;
20 import com.mapd.thrift.server.TMapDException;
21 import com.mapd.thrift.server.TServerStatus;
22 
23 import org.apache.thrift.TException;
24 import org.apache.thrift.protocol.TBinaryProtocol;
25 import org.apache.thrift.protocol.TJSONProtocol;
26 import org.apache.thrift.protocol.TProtocol;
27 import org.apache.thrift.transport.TTransport;
28 import org.apache.thrift.transport.TTransportException;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
31 
32 import java.sql.Array;
33 import java.sql.Blob;
34 import java.sql.CallableStatement;
35 import java.sql.Clob;
36 import java.sql.Connection;
37 import java.sql.DatabaseMetaData;
38 import java.sql.NClob;
39 import java.sql.PreparedStatement;
40 import java.sql.SQLClientInfoException;
41 import java.sql.SQLException;
42 import java.sql.SQLWarning;
43 import java.sql.SQLXML;
44 import java.sql.Savepoint;
45 import java.sql.Statement;
46 import java.sql.Struct;
47 import java.util.*;
48 import java.util.concurrent.Executor;
49 
54 /*
55  * Param_pair - Simple pair class to hold the label for a component in the url
56  * and an index into the url to that component. For example in the url
57  * jdbc:mapd:hostname:6278 a Param_pair for hostname would have a label of
58  * "hostname" and an index of 2
59  *
60  */
61 class Param_pair {
62  public Param_pair(String l, int i) {
63  label = l;
64  index = i;
65  }
66 
67  public String label;
68  public int index;
69 }
70 
79  user_passwd
80 }
81 
82 public class OmniSciConnection implements java.sql.Connection {
83  final static Logger logger = LoggerFactory.getLogger(OmniSciConnection.class);
84 
85  // A simple internal class to hold a summary of the properties passed to the
86  // connection
87  // Properties can come two ways - via the url or via a Properties param
88  class Connection_properties extends Hashtable<Connection_enums, Object> {
89  // All 'used' properties should be listed in this enum map
90  EnumMap<Connection_enums, Param_pair> connection_map =
91  new EnumMap<Connection_enums, Param_pair>(Connection_enums.class) {
92  {
93  // the map allows peoperties to be access via a enum rather than string
94  put(Connection_enums.host_name, new Param_pair("host_name", 2));
95  put(Connection_enums.port_num, new Param_pair("port_num", 3));
96  put(Connection_enums.db_name, new Param_pair("db_name", 4));
97  put(Connection_enums.protocol, new Param_pair("protocol", 5));
98  put(Connection_enums.key_store, new Param_pair("key_store", 6));
99  put(Connection_enums.key_store_pwd, new Param_pair("key_store_pwd", 7));
100  put(Connection_enums.user, new Param_pair("user", 100));
101  put(Connection_enums.user_passwd, new Param_pair("password", 101));
102  }
103  };
104  protected boolean parm_warning = false;
105 
106  public Connection_properties(Properties properties, String connection_url) {
107  super();
108  String[] url_values = connection_url.split(":");
109 
110  // Look for all possible properties values
111  for (Connection_enums enum_key : connection_map.keySet()) {
112  // Get each entry - a string to index the properties param (such as host_name
113  // and an int to index it into the URL, such as 5 for host_name.
114  // index will be greater than 99 if the value shouldn't be expected in the URL
115  Param_pair param_pair = connection_map.get(enum_key);
116  String value_from_prop = null;
117  String value_from_url = null;
118  // if the index is inside the range of the URL then grab the value
119  if (param_pair.index < url_values.length) {
120  value_from_url = url_values[param_pair.index];
121  }
122 
123  // Grab the possible value from the properties variable, using the already
124  // obtained value_from_url as the default if the entry isn't in properties
125  // (note value_from_url could still be null in which case value_from_prop will
126  // be null)
127  value_from_prop = properties.getProperty(param_pair.label, value_from_url);
128  if (value_from_url != null && value_from_prop != null) {
129  if (!value_from_prop.equals(value_from_url)) {
130  logger.warn("Connected property in url[" + value_from_url
131  + "] differs from Properties class [" + value_from_prop
132  + "]. Using url version");
133  value_from_prop = value_from_url;
134  parm_warning = true;
135  }
136  }
137  if (value_from_prop != null) this.put(enum_key, value_from_prop);
138  }
139  // Make sure we have all that is needed and in the correct format
140  validate_params();
141  }
142 
143  private void validate_params() {
144  // if present remove "//" from front of hostname
145  String hN = (String) this.get(Connection_enums.host_name);
146  if (hN.startsWith("//")) {
147  this.put(Connection_enums.host_name, hN.substring(2));
148  }
149  Integer port_num = Integer.parseInt((String) (this.get(Connection_enums.port_num)));
150  this.put(Connection_enums.port_num, port_num);
151  // Default to binary of no protocol specified
152  String protocol = "binary";
153  if (this.containsKey(Connection_enums.protocol)) {
154  protocol = (String) this.get(Connection_enums.protocol);
155  protocol.toLowerCase();
156  if (!protocol.equals("binary") && !protocol.equals("http")
157  && !protocol.equals("https") && !protocol.equals("https_insecure")) {
158  logger.warn("Incorrect protcol [" + protocol
159  + "] supplied. Possible values are [binary | http | https | https_insecure]. Using binary as default");
160  protocol = "binary";
161  parm_warning = true;
162  }
163  }
164  this.put(Connection_enums.protocol, protocol);
165  if (this.containsKey(Connection_enums.key_store)
166  && !this.containsKey(Connection_enums.key_store_pwd)) {
167  logger.warn("key store [" + (String) this.get(Connection_enums.key_store)
168  + " specfied without a password");
169  parm_warning = true;
170  }
171  if (this.containsKey(Connection_enums.key_store_pwd)
172  && !this.containsKey(Connection_enums.key_store)) {
173  logger.warn("key store password specified without a keystore file");
174  parm_warning = true;
175  }
176  }
177 
178  boolean isHttpProtocol() {
179  return (this.containsKey(Connection_enums.protocol)
180  && this.get(Connection_enums.protocol).equals("http"));
181  }
182 
184  return (this.containsKey(Connection_enums.protocol)
185  && this.get(Connection_enums.protocol).equals("https_insecure"));
186  }
187 
188  boolean isHttpsProtocol() {
189  return (this.containsKey(Connection_enums.protocol)
190  && this.get(Connection_enums.protocol).equals("https"));
191  }
192 
193  boolean isBinary() {
194  return (this.containsKey(Connection_enums.protocol)
195  && this.get(Connection_enums.protocol).equals("binary"));
196  }
197 
198  boolean containsTrustStore() {
199  return this.containsKey(Connection_enums.key_store);
200  }
201  } /*
202  * End class Connection_properties extends Hashtable<Connection_enums, Object>
203  */
204 
205  protected String session = null;
206  protected MapD.Client client = null;
207  protected String catalog;
208  protected TTransport transport;
209  protected SQLWarning warnings;
210  protected String url;
211  protected Connection_properties cP = null;
212 
213  public OmniSciConnection(String url, Properties info)
214  throws SQLException { // logger.debug("Entered");
215  this.url = url;
216  this.cP = new Connection_properties(info, url);
217  SockTransportProperties skT = null;
218  String key_store = null;
219  if (cP.get(Connection_enums.key_store) != null
220  && !cP.get(Connection_enums.key_store).toString().isEmpty()) {
221  key_store = cP.get(Connection_enums.key_store).toString();
222  }
223  String key_store_pwd = null;
224  if (cP.get(Connection_enums.key_store_pwd) != null
225  && !cP.get(Connection_enums.key_store_pwd).toString().isEmpty()) {
226  key_store_pwd = cP.get(Connection_enums.key_store_pwd).toString();
227  }
228  try {
229  // cP extends hashtable. hashtable get returns null when the
230  // key isn't present. If key_store and keys_store_pwd are not present
231  // skT should then load the default java certs file ca-cert.
232  TProtocol protocol = null;
233  if (this.cP.isHttpProtocol()) {
234  // HTTP
235  boolean load_trustinfo = false;
236  skT = new SockTransportProperties(load_trustinfo);
237  transport = skT.openHttpClientTransport(
238  (String) this.cP.get(Connection_enums.host_name),
239  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
240  transport.open();
241  protocol = new TJSONProtocol(transport);
242  } else if (this.cP.isHttpsProtocol()) {
243  // HTTPS - use CA cert to validate server cert and validate server name
244  skT = new SockTransportProperties(key_store, key_store_pwd);
245  transport = skT.openHttpsClientTransport(
246  (String) this.cP.get(Connection_enums.host_name),
247  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
248  transport.open();
249  protocol = new TJSONProtocol(transport);
250  } else if (this.cP.isHttpsProtocol_insecure()) {
251  // HTTPS_INSECURE - trust all server names and certs but still encrypt pipe
252  boolean load_trustinfo = false;
253  skT = new SockTransportProperties(load_trustinfo);
254  transport = skT.openHttpsClientTransport(
255  (String) this.cP.get(Connection_enums.host_name),
256  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
257  transport.open();
258  protocol = new TJSONProtocol(transport);
259  } else if (cP.isBinary()) {
260  // jdbc binary was implmented first. It will currently look for a
261  // specified trust file, but doesn't look
262  // for any of the default java trust stores
263  if (key_store == null || key_store.isEmpty()) {
264  // un encryoted
265  boolean load_trustinfo = false;
266  skT = new SockTransportProperties(load_trustinfo);
267  transport = skT.openClientTransport(
268  (String) this.cP.get(Connection_enums.host_name),
269  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
270  } else {
271  // encryoted
272  skT = new SockTransportProperties(key_store, key_store_pwd);
273  transport = skT.openClientTransportEncrypted(
274  (String) this.cP.get(Connection_enums.host_name),
275  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
276  }
277  if (!transport.isOpen()) transport.open();
278  protocol = new TBinaryProtocol(transport);
279  } else {
280  throw new RuntimeException("Invalid protocol supplied");
281  }
282 
283  client = new MapD.Client(protocol);
284  session = client.connect((String) this.cP.get(Connection_enums.user),
285  (String) this.cP.get(Connection_enums.user_passwd),
286  (String) this.cP.get(Connection_enums.db_name));
287 
288  catalog = (String) this.cP.get(Connection_enums.db_name);
289  logger.debug("Connected session is " + session);
290 
291  } catch (TTransportException ex) {
292  throw new SQLException("Connection failed - " + ex.toString());
293  } catch (TMapDException ex) {
294  throw new SQLException("Connection failed - " + ex.toString());
295  } catch (TException ex) {
296  throw new SQLException("Connection failed - " + ex.toString());
297  } catch (java.lang.Exception ex) {
298  throw new SQLException("Connection failed - " + ex.toString());
299  }
300  }
301 
302  @Override
303  public Statement createStatement() throws SQLException { // logger.debug("Entered");
304  return new OmniSciStatement(session, client);
305  }
306 
307  @Override
308  public PreparedStatement prepareStatement(String sql)
309  throws SQLException { // logger.debug("Entered");
310  return new OmniSciPreparedStatement(sql, session, client);
311  }
312 
313  @Override
314  public CallableStatement prepareCall(String sql)
315  throws SQLException { // logger.debug("Entered");
316  throw new UnsupportedOperationException("Not supported yet,"
317  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
318  + " class:" + new Throwable().getStackTrace()[0].getClassName()
319  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
320  }
321 
322  @Override
323  public String nativeSQL(String sql) throws SQLException { // logger.debug("Entered");
324  throw new UnsupportedOperationException("Not supported yet,"
325  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
326  + " class:" + new Throwable().getStackTrace()[0].getClassName()
327  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
328  }
329 
330  @Override
331  public void setAutoCommit(boolean autoCommit)
332  throws SQLException { // logger.debug("Entered");
333  // we always autocommit per statement
334  }
335 
336  @Override
337  public boolean getAutoCommit() throws SQLException { // logger.debug("Entered");
338  return true;
339  }
340 
341  @Override
342  public void commit() throws SQLException { // logger.debug("Entered");
343  // noop
344  }
345 
346  @Override
347  public void rollback() throws SQLException { // logger.debug("Entered");
348  throw new UnsupportedOperationException("Not supported yet,"
349  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
350  + " class:" + new Throwable().getStackTrace()[0].getClassName()
351  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
352  }
353 
354  @Override
355  public void close() throws SQLException { // logger.debug("Entered");
356  try {
357  logger.debug("Session at close is " + session);
358  if (session != null) {
359  client.disconnect(session);
360  }
361  session = null;
362  transport.close();
363  } catch (TMapDException ex) {
364  throw new SQLException("disconnect failed." + ex.toString());
365  } catch (TException ex) {
366  throw new SQLException("disconnect failed." + ex.toString());
367  }
368  }
369 
370  @Override
371  public boolean isClosed() throws SQLException { // logger.debug("Entered");
372  if (session == null) {
373  return true;
374  }
375  return false;
376  }
377 
378  @Override
379  public DatabaseMetaData getMetaData() throws SQLException { // logger.debug("Entered");
380  DatabaseMetaData mapDMetaData = new OmniSciDatabaseMetaData(this);
381 
382  return mapDMetaData;
383  }
384 
385  @Override
386  public void setReadOnly(boolean readOnly)
387  throws SQLException { // logger.debug("Entered");
388  // TODO MAT we can't push the readonly upstream currently
389  // but we could make JDBC obey this command
390  }
391 
392  @Override
393  public boolean isReadOnly() throws SQLException { // logger.debug("Entered");
394  try {
395  if (session != null) {
396  TServerStatus server_status = client.get_server_status(session);
397  return server_status.read_only;
398  }
399  } catch (TMapDException ex) {
400  throw new SQLException(
401  "get_server_status failed during isReadOnly check." + ex.toString());
402  } catch (TException ex) {
403  throw new SQLException(
404  "get_server_status failed during isReadOnly check." + ex.toString());
405  }
406  // never should get here
407  return true;
408  }
409 
410  @Override
411  public void setCatalog(String catalog) throws SQLException { // logger.debug("Entered");
412  throw new UnsupportedOperationException("Not supported yet,"
413  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
414  + " class:" + new Throwable().getStackTrace()[0].getClassName()
415  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
416  }
417 
418  @Override
419  public String getCatalog() throws SQLException { // logger.debug("Entered");
420  return catalog;
421  }
422 
423  @Override
425  throws SQLException { // logger.debug("Entered");
426  }
427 
428  @Override
429  public int getTransactionIsolation() throws SQLException { // logger.debug("Entered");
430  return Connection.TRANSACTION_NONE;
431  }
432 
433  @Override
434  public SQLWarning getWarnings() throws SQLException { // logger.debug("Entered");
435  return warnings;
436  }
437 
438  @Override
439  public void clearWarnings() throws SQLException { // logger.debug("Entered");
440  warnings = null;
441  }
442 
443  @Override
444  public Statement createStatement(int resultSetType, int resultSetConcurrency)
445  throws SQLException { // logger.debug("Entered");
446  return new OmniSciStatement(session, client);
447  }
448 
449  @Override
450  public PreparedStatement prepareStatement(
451  String sql, int resultSetType, int resultSetConcurrency)
452  throws SQLException { // logger.debug("Entered");
453  return new OmniSciPreparedStatement(sql, session, client);
454  }
455 
456  @Override
457  public CallableStatement prepareCall(
458  String sql, int resultSetType, int resultSetConcurrency)
459  throws SQLException { // logger.debug("Entered");
460  throw new UnsupportedOperationException("Not supported yet,"
461  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
462  + " class:" + new Throwable().getStackTrace()[0].getClassName()
463  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
464  }
465 
466  @Override
467  public Map<String, Class<?>> getTypeMap()
468  throws SQLException { // logger.debug("Entered");
469  throw new UnsupportedOperationException("Not supported yet,"
470  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
471  + " class:" + new Throwable().getStackTrace()[0].getClassName()
472  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
473  }
474 
475  @Override
476  public void setTypeMap(Map<String, Class<?>> map)
477  throws SQLException { // logger.debug("Entered");
478  throw new UnsupportedOperationException("Not supported yet,"
479  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
480  + " class:" + new Throwable().getStackTrace()[0].getClassName()
481  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
482  }
483 
484  @Override
485  public void setHoldability(int holdability)
486  throws SQLException { // logger.debug("Entered");
487  throw new UnsupportedOperationException("Not supported yet,"
488  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
489  + " class:" + new Throwable().getStackTrace()[0].getClassName()
490  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
491  }
492 
493  @Override
494  public int getHoldability() throws SQLException { // logger.debug("Entered");
495  throw new UnsupportedOperationException("Not supported yet,"
496  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
497  + " class:" + new Throwable().getStackTrace()[0].getClassName()
498  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
499  }
500 
501  @Override
502  public Savepoint setSavepoint() throws SQLException { // logger.debug("Entered");
503  throw new UnsupportedOperationException("Not supported yet,"
504  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
505  + " class:" + new Throwable().getStackTrace()[0].getClassName()
506  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
507  }
508 
509  @Override
510  public Savepoint setSavepoint(String name)
511  throws SQLException { // logger.debug("Entered");
512  throw new UnsupportedOperationException("Not supported yet,"
513  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
514  + " class:" + new Throwable().getStackTrace()[0].getClassName()
515  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
516  }
517 
518  @Override
519  public void rollback(Savepoint savepoint)
520  throws SQLException { // logger.debug("Entered");
521  throw new UnsupportedOperationException("Not supported yet,"
522  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
523  + " class:" + new Throwable().getStackTrace()[0].getClassName()
524  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
525  }
526 
527  @Override
528  public void releaseSavepoint(Savepoint savepoint)
529  throws SQLException { // logger.debug("Entered");
530  throw new UnsupportedOperationException("Not supported yet,"
531  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
532  + " class:" + new Throwable().getStackTrace()[0].getClassName()
533  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
534  }
535 
536  @Override
537  public Statement createStatement(
538  int resultSetType, int resultSetConcurrency, int resultSetHoldability)
539  throws SQLException { // logger.debug("Entered");
540  throw new UnsupportedOperationException("Not supported yet,"
541  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
542  + " class:" + new Throwable().getStackTrace()[0].getClassName()
543  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
544  }
545 
546  @Override
547  public PreparedStatement prepareStatement(String sql,
548  int resultSetType,
549  int resultSetConcurrency,
550  int resultSetHoldability) throws SQLException { // logger.debug("Entered");
551  throw new UnsupportedOperationException("Not supported yet,"
552  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
553  + " class:" + new Throwable().getStackTrace()[0].getClassName()
554  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
555  }
556 
557  @Override
558  public CallableStatement prepareCall(String sql,
559  int resultSetType,
560  int resultSetConcurrency,
561  int resultSetHoldability) throws SQLException { // logger.debug("Entered");
562  throw new UnsupportedOperationException("Not supported yet,"
563  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
564  + " class:" + new Throwable().getStackTrace()[0].getClassName()
565  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
566  }
567 
568  @Override
569  public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
570  throws SQLException { // logger.debug("Entered");
571  throw new UnsupportedOperationException("Not supported yet,"
572  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
573  + " class:" + new Throwable().getStackTrace()[0].getClassName()
574  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
575  }
576 
577  @Override
578  public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
579  throws SQLException { // logger.debug("Entered");
580  throw new UnsupportedOperationException("Not supported yet,"
581  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
582  + " class:" + new Throwable().getStackTrace()[0].getClassName()
583  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
584  }
585 
586  @Override
587  public PreparedStatement prepareStatement(String sql, String[] columnNames)
588  throws SQLException { // logger.debug("Entered");
589  throw new UnsupportedOperationException("Not supported yet,"
590  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
591  + " class:" + new Throwable().getStackTrace()[0].getClassName()
592  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
593  }
594 
595  @Override
596  public Clob createClob() throws SQLException { // logger.debug("Entered");
597  throw new UnsupportedOperationException("Not supported yet,"
598  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
599  + " class:" + new Throwable().getStackTrace()[0].getClassName()
600  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
601  }
602 
603  @Override
604  public Blob createBlob() throws SQLException { // logger.debug("Entered");
605  throw new UnsupportedOperationException("Not supported yet,"
606  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
607  + " class:" + new Throwable().getStackTrace()[0].getClassName()
608  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
609  }
610 
611  @Override
612  public NClob createNClob() throws SQLException { // logger.debug("Entered");
613  throw new UnsupportedOperationException("Not supported yet,"
614  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
615  + " class:" + new Throwable().getStackTrace()[0].getClassName()
616  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
617  }
618 
619  @Override
620  public SQLXML createSQLXML() throws SQLException { // logger.debug("Entered");
621  throw new UnsupportedOperationException("Not supported yet,"
622  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
623  + " class:" + new Throwable().getStackTrace()[0].getClassName()
624  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
625  }
626 
627  @Override
628  public boolean isValid(int timeout) throws SQLException { // logger.debug("Entered");
629  try {
630  client.get_server_status(session);
631  } catch (TTransportException ex) {
632  throw new SQLException("Connection failed - " + ex.toString());
633  } catch (TMapDException ex) {
634  throw new SQLException("Connection failed - " + ex.toString());
635  } catch (TException ex) {
636  throw new SQLException("Connection failed - " + ex.toString());
637  }
638  return true;
639  }
640 
641  @Override
642  public void setClientInfo(String name, String value) throws SQLClientInfoException {
643  throw new UnsupportedOperationException("Not supported yet,"
644  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
645  + " class:" + new Throwable().getStackTrace()[0].getClassName()
646  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
647  }
648 
649  @Override
650  public void setClientInfo(Properties properties) throws SQLClientInfoException {
651  throw new UnsupportedOperationException("Not supported yet,"
652  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
653  + " class:" + new Throwable().getStackTrace()[0].getClassName()
654  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
655  }
656 
657  @Override
659  throws SQLException { // logger.debug("Entered");
660  throw new UnsupportedOperationException("Not supported yet,"
661  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
662  + " class:" + new Throwable().getStackTrace()[0].getClassName()
663  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
664  }
665 
666  @Override
667  public Properties getClientInfo() throws SQLException { // logger.debug("Entered");
668  throw new UnsupportedOperationException("Not supported yet,"
669  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
670  + " class:" + new Throwable().getStackTrace()[0].getClassName()
671  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
672  }
673 
674  @Override
675  public Array createArrayOf(String typeName, Object[] elements)
676  throws SQLException { // logger.debug("Entered");
677  throw new UnsupportedOperationException("Not supported yet,"
678  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
679  + " class:" + new Throwable().getStackTrace()[0].getClassName()
680  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
681  }
682 
683  @Override
684  public Struct createStruct(String typeName, Object[] attributes)
685  throws SQLException { // logger.debug("Entered");
686  throw new UnsupportedOperationException("Not supported yet,"
687  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
688  + " class:" + new Throwable().getStackTrace()[0].getClassName()
689  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
690  }
691 
692  @Override
693  public void setSchema(String schema) throws SQLException { // logger.debug("Entered");
694  throw new UnsupportedOperationException("Not supported yet,"
695  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
696  + " class:" + new Throwable().getStackTrace()[0].getClassName()
697  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
698  }
699 
700  @Override
701  public String getSchema() throws SQLException { // logger.debug("Entered");
702  throw new UnsupportedOperationException("Not supported yet,"
703  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
704  + " class:" + new Throwable().getStackTrace()[0].getClassName()
705  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
706  }
707 
708  @Override
709  public void abort(Executor executor) throws SQLException { // logger.debug("Entered");
710  throw new UnsupportedOperationException("Not supported yet,"
711  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
712  + " class:" + new Throwable().getStackTrace()[0].getClassName()
713  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
714  }
715 
716  @Override
717  public void setNetworkTimeout(Executor executor, int milliseconds)
718  throws SQLException { // logger.debug("Entered");
719  throw new UnsupportedOperationException("Not supported yet,"
720  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
721  + " class:" + new Throwable().getStackTrace()[0].getClassName()
722  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
723  }
724 
725  @Override
726  public int getNetworkTimeout() throws SQLException { // logger.debug("Entered");
727  throw new UnsupportedOperationException("Not supported yet,"
728  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
729  + " class:" + new Throwable().getStackTrace()[0].getClassName()
730  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
731  }
732 
733  @Override
734  public <T> T unwrap(Class<T> iface) throws SQLException { // logger.debug("Entered");
735  throw new UnsupportedOperationException("Not supported yet,"
736  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
737  + " class:" + new Throwable().getStackTrace()[0].getClassName()
738  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
739  }
740 
741  @Override
742  public boolean isWrapperFor(Class<?> iface)
743  throws SQLException { // logger.debug("Entered");
744  throw new UnsupportedOperationException("Not supported yet,"
745  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
746  + " class:" + new Throwable().getStackTrace()[0].getClassName()
747  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
748  }
749 }
public< T > T unwrap(Class< T > iface)
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
Connection_properties(Properties properties, String connection_url)
TTransport openHttpClientTransport(String server_host, int port)
TTransport openHttpsClientTransport(String server_host, int port)
auto sql(const std::string &sql_stmts)
void setAutoCommit(boolean autoCommit)
TTransport openClientTransport(String server_host, int port)
void setClientInfo(String name, String value)
void releaseSavepoint(Savepoint savepoint)
void rollback(Savepoint savepoint)
PreparedStatement prepareStatement(String sql)
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Array createArrayOf(String typeName, Object[] elements)
PreparedStatement prepareStatement(String sql, String[] columnNames)
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
TTransport openClientTransportEncrypted(String server_host, int port)
mapd::shared_ptr< MapDClient > client
void setClientInfo(Properties properties)
Map< String, Class<?> > getTypeMap()
Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
Statement createStatement(int resultSetType, int resultSetConcurrency)
CallableStatement prepareCall(String sql)
Struct createStruct(String typeName, Object[] attributes)
void setNetworkTimeout(Executor executor, int milliseconds)
OmniSciConnection(String url, Properties info)
PreparedStatement prepareStatement(String sql, int[] columnIndexes)
TSessionId session
void setTypeMap(Map< String, Class<?>> map)