OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.io.*;
33 import java.nio.file.Files;
34 import java.security.*;
35 import java.security.cert.X509Certificate;
36 import java.security.spec.PKCS8EncodedKeySpec;
37 import java.sql.Array;
38 import java.sql.Blob;
39 import java.sql.CallableStatement;
40 import java.sql.Clob;
41 import java.sql.Connection;
42 import java.sql.DatabaseMetaData;
43 import java.sql.NClob;
44 import java.sql.PreparedStatement;
45 import java.sql.SQLClientInfoException;
46 import java.sql.SQLException;
47 import java.sql.SQLWarning;
48 import java.sql.SQLXML;
49 import java.sql.Savepoint;
50 import java.sql.Statement;
51 import java.sql.Struct;
52 import java.util.*;
53 import java.util.concurrent.Executor;
54 
55 import javax.crypto.Cipher;
56 
57 import sun.security.provider.X509Factory;
62 /*
63  * Param_pair - Simple pair class to hold the label for a component in the url
64  * and an index into the url to that component. For example in the url
65  * jdbc:mapd:hostname:6278 a Param_pair for hostname would have a label of
66  * "hostname" and an index of 2
67  *
68  */
69 class Param_pair {
70  public Param_pair(String l, int i) {
71  label = l;
72  index = i;
73  }
74 
75  public String label;
76  public int index;
77 }
78 
91  user_passwd
92 }
93 
94 class KeyLoader {
95  static class S_struct {
96  public String cert;
97  public Key key;
98  }
99 
100  public static String getX509(X509Certificate cert) throws Exception {
101  String encoded = Base64.getMimeEncoder().encodeToString(cert.getEncoded());
102  // Note mimeEncoder inserts \r\n in the text - the server is okay with that.
103  encoded = X509Factory.BEGIN_CERT + "\n" + encoded + "\n" + X509Factory.END_CERT;
104  return encoded;
105  }
106 
108  throws Exception {
109  S_struct s_struct = new S_struct();
110  try {
111  KeyStore keystore = KeyStore.getInstance("PKCS12");
112  java.io.FileInputStream fis = new java.io.FileInputStream(filename);
113  keystore.load(fis, password.toCharArray());
114  String alias = null;
115  Enumeration<String> eE = keystore.aliases();
116  int count = 0;
117  while (eE.hasMoreElements()) {
118  alias = eE.nextElement();
119  count++;
120  }
121  if (count != 1) {
122  throw new RuntimeException("pkcs12 file [" + filename
123  + "] contains an incorrect number [" + count
124  + "] of certificate(s); only a single certificate is allowed");
125  }
126 
127  X509Certificate cert = (X509Certificate) keystore.getCertificate(alias);
128  s_struct.cert = getX509(cert);
129  s_struct.key = keystore.getKey(alias, password.toCharArray());
130  } catch (Exception eX) {
131  OmniSciConnection.logger.error(eX.getMessage());
132  throw eX;
133  }
134  return s_struct;
135  }
136 }
137 
138 public class OmniSciConnection implements java.sql.Connection {
139  final static Logger logger = LoggerFactory.getLogger(OmniSciConnection.class);
140 
141  Set<String> protocol_set = new HashSet<String>(
142  Arrays.asList("binary", "binary_tls", "http", "https", "https_insecure"));
143  // A simple internal class to hold a summary of the properties passed to the
144  // connection
145  // Properties can come two ways - via the url or via a Properties param
146  class Connection_properties extends Hashtable<Connection_enums, Object> {
147  // All 'used' properties should be listed in this enum map
148  EnumMap<Connection_enums, Param_pair> connection_map =
149  new EnumMap<Connection_enums, Param_pair>(Connection_enums.class) {
150  {
151  // the map allows peoperties to be access via a enum rather than string
152  put(Connection_enums.host_name, new Param_pair("host_name", 2));
153  put(Connection_enums.port_num, new Param_pair("port_num", 3));
154  put(Connection_enums.db_name, new Param_pair("db_name", 4));
155  put(Connection_enums.protocol, new Param_pair("protocol", 5));
157  new Param_pair("server_trust_store", 6));
159  new Param_pair("server_trust_store_pwd", 7));
160  put(Connection_enums.pkiauth, new Param_pair("pkiauth", 7));
161  put(Connection_enums.sslcert, new Param_pair("sslcert", 8));
162  put(Connection_enums.sslkey, new Param_pair("sslkey", 9));
164  new Param_pair("sslkey_password", 10));
165  put(Connection_enums.user, new Param_pair("user", 100));
166  put(Connection_enums.user_passwd, new Param_pair("password", 101));
167  }
168  };
169  protected boolean parm_warning = false;
170 
171  public Connection_properties(Properties properties, String connection_url) {
172  super();
173  String[] url_values = connection_url.split(":");
174 
175  // Look for all possible properties values
176  for (Connection_enums enum_key : connection_map.keySet()) {
177  // Get each entry - a string to index the properties param (such as host_name
178  // and an int to index it into the URL, such as 5 for host_name.
179  // index will be greater than 99 if the value shouldn't be expected in the URL
180  Param_pair param_pair = connection_map.get(enum_key);
181  String value_from_prop = null;
182  String value_from_url = null;
183  // if the index is inside the range of the URL then grab the value
184  if (param_pair.index < url_values.length) {
185  value_from_url = url_values[param_pair.index];
186  }
187 
188  // Grab the possible value from the properties variable, using the already
189  // obtained value_from_url as the default if the entry isn't in properties
190  // (note value_from_url could still be null in which case value_from_prop will
191  // be null)
192  value_from_prop = properties.getProperty(param_pair.label, value_from_url);
193  if (value_from_url != null && value_from_prop != null) {
194  if (!value_from_prop.equals(value_from_url)) {
195  logger.warn("Connected property in url[" + value_from_url
196  + "] differs from Properties class [" + value_from_prop
197  + "]. Using url version");
198  value_from_prop = value_from_url;
199  parm_warning = true;
200  }
201  }
202  if (value_from_prop != null) this.put(enum_key, value_from_prop);
203  }
204  // Make sure we have all that is needed and in the correct format
205  validate_params();
206  }
207 
208  private void validate_params() {
209  // if present remove "//" from front of hostname
210  String hN = (String) this.get(Connection_enums.host_name);
211  if (hN.startsWith("//")) {
212  this.put(Connection_enums.host_name, hN.substring(2));
213  }
214  Integer port_num = Integer.parseInt((String) (this.get(Connection_enums.port_num)));
215  this.put(Connection_enums.port_num, port_num);
216  // Default to binary of no protocol specified
217  String protocol = "binary";
218  if (this.containsKey(Connection_enums.protocol)) {
219  protocol = (String) this.get(Connection_enums.protocol);
220  protocol.toLowerCase();
221  if (!protocol_set.contains(protocol)) {
222  logger.warn("Incorrect protcol [" + protocol
223  + "] supplied. Possible values are [" + protocol_set.toString()
224  + "]. Using binary as default");
225  protocol = "binary";
226  parm_warning = true;
227  }
228  }
229  this.put(Connection_enums.protocol, protocol);
230  if (this.containsKey(Connection_enums.server_trust_store)
231  && !this.containsKey(Connection_enums.server_trust_store_pwd)) {
232  logger.warn("server trust store ["
234  + " specfied without a password");
235  parm_warning = true;
236  }
237  if (this.containsKey(Connection_enums.server_trust_store_pwd)
238  && !this.containsKey(Connection_enums.server_trust_store)) {
239  logger.warn("server trust store password specified without a keystore file");
240  parm_warning = true;
241  }
242  }
243 
244  boolean isHttpProtocol() {
245  return (this.containsKey(Connection_enums.protocol)
246  && this.get(Connection_enums.protocol).equals("http"));
247  }
248 
250  return (this.containsKey(Connection_enums.protocol)
251  && this.get(Connection_enums.protocol).equals("https_insecure"));
252  }
253 
254  boolean isHttpsProtocol() {
255  return (this.containsKey(Connection_enums.protocol)
256  && this.get(Connection_enums.protocol).equals("https"));
257  }
258 
259  boolean isBinary() {
260  return (this.containsKey(Connection_enums.protocol)
261  && this.get(Connection_enums.protocol).equals("binary"));
262  }
263  boolean isBinary_tls() {
264  return (this.containsKey(Connection_enums.protocol)
265  && this.get(Connection_enums.protocol).equals("binary_tls"));
266  }
267  boolean containsTrustStore() {
268  return this.containsKey(Connection_enums.server_trust_store);
269  }
270  } /*
271  * End class Connection_properties extends Hashtable<Connection_enums, Object>
272  */
273 
274  protected String session = null;
275  protected MapD.Client client = null;
276  protected String catalog;
277  protected TTransport transport;
278  protected SQLWarning warnings;
279  protected String url;
280  protected Connection_properties cP = null;
281 
282  public OmniSciConnection(String url, Properties info)
283  throws SQLException { // logger.debug("Entered");
284  this.url = url;
285  this.cP = new Connection_properties(info, url);
286  SockTransportProperties skT = null;
287  String trust_store = null;
288  if (cP.get(Connection_enums.server_trust_store) != null
289  && !cP.get(Connection_enums.server_trust_store).toString().isEmpty()) {
290  trust_store = cP.get(Connection_enums.server_trust_store).toString();
291  }
292  String trust_store_pwd = null;
294  && !cP.get(Connection_enums.server_trust_store_pwd).toString().isEmpty()) {
295  trust_store_pwd = cP.get(Connection_enums.server_trust_store_pwd).toString();
296  }
297  try {
298  // cP extends hashtable. hashtable get returns null when the
299  // key isn't present. If trust_store and keys_store_pwd are not present
300  // skT should then load the default java certs file ca-cert.
301  TProtocol protocol = null;
302  if (this.cP.isHttpProtocol()) {
303  // HTTP
304  skT = SockTransportProperties.getUnencryptedClient();
305  transport = skT.openHttpClientTransport(
306  (String) this.cP.get(Connection_enums.host_name),
307  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
308  transport.open();
309  protocol = new TJSONProtocol(transport);
310 
311  } else if (this.cP.isBinary()) {
312  skT = SockTransportProperties.getUnencryptedClient();
313  transport =
314  skT.openClientTransport((String) this.cP.get(Connection_enums.host_name),
315  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
316  if (!transport.isOpen()) transport.open();
317  protocol = new TBinaryProtocol(transport);
318 
319  } else if (this.cP.isHttpsProtocol() || this.cP.isHttpsProtocol_insecure()) {
320  if (trust_store == null) {
321  skT = SockTransportProperties.getEncryptedClientDefaultTrustStore(
322  !this.cP.isHttpsProtocol_insecure());
323  } else {
324  skT = SockTransportProperties.getEncryptedClientSpecifiedTrustStore(
325  trust_store, trust_store_pwd, !this.cP.isHttpsProtocol_insecure());
326  }
327  transport = skT.openHttpsClientTransport(
328  (String) this.cP.get(Connection_enums.host_name),
329  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
330  transport.open();
331  protocol = new TJSONProtocol(transport);
332 
333  } else if (cP.isBinary_tls()) {
334  if (trust_store == null) {
335  skT = SockTransportProperties.getEncryptedClientDefaultTrustStore(false);
336  } else {
337  skT = SockTransportProperties.getEncryptedClientSpecifiedTrustStore(
338  trust_store, trust_store_pwd, false);
339  }
340  transport =
341  skT.openClientTransport((String) this.cP.get(Connection_enums.host_name),
342  ((Integer) this.cP.get(Connection_enums.port_num)).intValue());
343 
344  if (!transport.isOpen()) transport.open();
345  protocol = new TBinaryProtocol(transport);
346  } else {
347  throw new RuntimeException("Invalid protocol supplied");
348  }
349 
350  client = new MapD.Client(protocol);
351  KeyLoader.S_struct s_struct = null;
352  Object pki_auth = this.cP.get(Connection_enums.pkiauth);
353  if (pki_auth != null && pki_auth.toString().equalsIgnoreCase("true")) {
354  s_struct = KeyLoader.getDetails_pkcs12(
355  this.cP.get(Connection_enums.sslcert).toString(),
356  this.cP.get(Connection_enums.sslkey_password).toString());
357  this.cP.put(Connection_enums.user_passwd, s_struct.cert);
358  }
359  session = client.connect((String) this.cP.get(Connection_enums.user),
361  (String) this.cP.get(Connection_enums.db_name));
362  if (pki_auth != null && pki_auth.toString().equalsIgnoreCase("true")) {
363  Cipher cipher = Cipher.getInstance(s_struct.key.getAlgorithm());
364  cipher.init(Cipher.DECRYPT_MODE, s_struct.key);
365  // session is encrypted and encoded in b64
366  byte[] decodedBytes = Base64.getDecoder().decode(session);
367  byte[] decoded_bytes = cipher.doFinal(decodedBytes);
368  session = new String(decoded_bytes, "UTF-8");
369  }
370  catalog = (String) this.cP.get(Connection_enums.db_name);
371  logger.debug("Connected session is " + session);
372 
373  } catch (TTransportException ex) {
374  throw new SQLException("Connection failed - " + ex.toString());
375  } catch (TMapDException ex) {
376  throw new SQLException("Connection failed - " + ex.toString());
377  } catch (TException ex) {
378  throw new SQLException("Connection failed - " + ex.toString());
379  } catch (java.lang.Exception ex) {
380  throw new SQLException("Connection failed - " + ex.toString());
381  }
382  }
383 
384  @Override
385  public Statement createStatement() throws SQLException { // logger.debug("Entered");
386  return new OmniSciStatement(session, client);
387  }
388 
389  @Override
390  public PreparedStatement prepareStatement(String sql)
391  throws SQLException { // logger.debug("Entered");
392  return new OmniSciPreparedStatement(sql, session, client);
393  }
394 
395  @Override
396  public CallableStatement prepareCall(String sql)
397  throws SQLException { // logger.debug("Entered");
398  throw new UnsupportedOperationException("Not supported yet,"
399  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
400  + " class:" + new Throwable().getStackTrace()[0].getClassName()
401  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
402  }
403 
404  @Override
405  public String nativeSQL(String sql) throws SQLException { // logger.debug("Entered");
406  throw new UnsupportedOperationException("Not supported yet,"
407  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
408  + " class:" + new Throwable().getStackTrace()[0].getClassName()
409  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
410  }
411 
412  @Override
413  public void setAutoCommit(boolean autoCommit)
414  throws SQLException { // logger.debug("Entered");
415  // we always autocommit per statement
416  }
417 
418  @Override
419  public boolean getAutoCommit() throws SQLException { // logger.debug("Entered");
420  return true;
421  }
422 
423  @Override
424  public void commit() throws SQLException { // logger.debug("Entered");
425  // noop
426  }
427 
428  @Override
429  public void rollback() throws SQLException { // logger.debug("Entered");
430  throw new UnsupportedOperationException("Not supported yet,"
431  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
432  + " class:" + new Throwable().getStackTrace()[0].getClassName()
433  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
434  }
435 
436  @Override
437  public void close() throws SQLException { // logger.debug("Entered");
438  try {
439  logger.debug("Session at close is " + session);
440  if (session != null) {
441  client.disconnect(session);
442  }
443  session = null;
444  transport.close();
445  } catch (TMapDException ex) {
446  throw new SQLException("disconnect failed." + ex.toString());
447  } catch (TException ex) {
448  throw new SQLException("disconnect failed." + ex.toString());
449  }
450  }
451 
452  @Override
453  public boolean isClosed() throws SQLException { // logger.debug("Entered");
454  if (session == null) {
455  return true;
456  }
457  return false;
458  }
459 
460  @Override
461  public DatabaseMetaData getMetaData() throws SQLException { // logger.debug("Entered");
462  DatabaseMetaData mapDMetaData = new OmniSciDatabaseMetaData(this);
463 
464  return mapDMetaData;
465  }
466 
467  @Override
468  public void setReadOnly(boolean readOnly)
469  throws SQLException { // logger.debug("Entered");
470  // TODO MAT we can't push the readonly upstream currently
471  // but we could make JDBC obey this command
472  }
473 
474  @Override
475  public boolean isReadOnly() throws SQLException { // logger.debug("Entered");
476  try {
477  if (session != null) {
478  TServerStatus server_status = client.get_server_status(session);
479  return server_status.read_only;
480  }
481  } catch (TMapDException ex) {
482  throw new SQLException(
483  "get_server_status failed during isReadOnly check." + ex.toString());
484  } catch (TException ex) {
485  throw new SQLException(
486  "get_server_status failed during isReadOnly check." + ex.toString());
487  }
488  // never should get here
489  return true;
490  }
491 
492  @Override
493  public void setCatalog(String catalog) throws SQLException { // logger.debug("Entered");
494  throw new UnsupportedOperationException("Not supported yet,"
495  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
496  + " class:" + new Throwable().getStackTrace()[0].getClassName()
497  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
498  }
499 
500  @Override
501  public String getCatalog() throws SQLException { // logger.debug("Entered");
502  return catalog;
503  }
504 
505  @Override
506  public void setTransactionIsolation(int level)
507  throws SQLException { // logger.debug("Entered");
508  }
509 
510  @Override
511  public int getTransactionIsolation() throws SQLException { // logger.debug("Entered");
512  return Connection.TRANSACTION_NONE;
513  }
514 
515  @Override
516  public SQLWarning getWarnings() throws SQLException { // logger.debug("Entered");
517  return warnings;
518  }
519 
520  @Override
521  public void clearWarnings() throws SQLException { // logger.debug("Entered");
522  warnings = null;
523  }
524 
525  @Override
526  public Statement createStatement(int resultSetType, int resultSetConcurrency)
527  throws SQLException { // logger.debug("Entered");
528  return new OmniSciStatement(session, client);
529  }
530 
531  @Override
532  public PreparedStatement prepareStatement(
533  String sql, int resultSetType, int resultSetConcurrency)
534  throws SQLException { // logger.debug("Entered");
535  return new OmniSciPreparedStatement(sql, session, client);
536  }
537 
538  @Override
539  public CallableStatement prepareCall(
540  String sql, int resultSetType, int resultSetConcurrency)
541  throws SQLException { // logger.debug("Entered");
542  throw new UnsupportedOperationException("Not supported yet,"
543  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
544  + " class:" + new Throwable().getStackTrace()[0].getClassName()
545  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
546  }
547 
548  @Override
549  public Map<String, Class<?>> getTypeMap()
550  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 void setTypeMap(Map<String, Class<?>> map)
559  throws SQLException { // logger.debug("Entered");
560  throw new UnsupportedOperationException("Not supported yet,"
561  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
562  + " class:" + new Throwable().getStackTrace()[0].getClassName()
563  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
564  }
565 
566  @Override
567  public void setHoldability(int holdability)
568  throws SQLException { // logger.debug("Entered");
569  throw new UnsupportedOperationException("Not supported yet,"
570  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
571  + " class:" + new Throwable().getStackTrace()[0].getClassName()
572  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
573  }
574 
575  @Override
576  public int getHoldability() throws SQLException { // logger.debug("Entered");
577  throw new UnsupportedOperationException("Not supported yet,"
578  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
579  + " class:" + new Throwable().getStackTrace()[0].getClassName()
580  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
581  }
582 
583  @Override
584  public Savepoint setSavepoint() throws SQLException { // logger.debug("Entered");
585  throw new UnsupportedOperationException("Not supported yet,"
586  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
587  + " class:" + new Throwable().getStackTrace()[0].getClassName()
588  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
589  }
590 
591  @Override
592  public Savepoint setSavepoint(String name)
593  throws SQLException { // logger.debug("Entered");
594  throw new UnsupportedOperationException("Not supported yet,"
595  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
596  + " class:" + new Throwable().getStackTrace()[0].getClassName()
597  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
598  }
599 
600  @Override
601  public void rollback(Savepoint savepoint)
602  throws SQLException { // logger.debug("Entered");
603  throw new UnsupportedOperationException("Not supported yet,"
604  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
605  + " class:" + new Throwable().getStackTrace()[0].getClassName()
606  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
607  }
608 
609  @Override
610  public void releaseSavepoint(Savepoint savepoint)
611  throws SQLException { // logger.debug("Entered");
612  throw new UnsupportedOperationException("Not supported yet,"
613  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
614  + " class:" + new Throwable().getStackTrace()[0].getClassName()
615  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
616  }
617 
618  @Override
619  public Statement createStatement(
620  int resultSetType, int resultSetConcurrency, int resultSetHoldability)
621  throws SQLException { // logger.debug("Entered");
622  throw new UnsupportedOperationException("Not supported yet,"
623  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
624  + " class:" + new Throwable().getStackTrace()[0].getClassName()
625  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
626  }
627 
628  @Override
629  public PreparedStatement prepareStatement(String sql,
630  int resultSetType,
631  int resultSetConcurrency,
632  int resultSetHoldability) throws SQLException { // logger.debug("Entered");
633  throw new UnsupportedOperationException("Not supported yet,"
634  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
635  + " class:" + new Throwable().getStackTrace()[0].getClassName()
636  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
637  }
638 
639  @Override
640  public CallableStatement prepareCall(String sql,
641  int resultSetType,
642  int resultSetConcurrency,
643  int resultSetHoldability) throws SQLException { // logger.debug("Entered");
644  throw new UnsupportedOperationException("Not supported yet,"
645  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
646  + " class:" + new Throwable().getStackTrace()[0].getClassName()
647  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
648  }
649 
650  @Override
651  public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
652  throws SQLException { // logger.debug("Entered");
653  throw new UnsupportedOperationException("Not supported yet,"
654  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
655  + " class:" + new Throwable().getStackTrace()[0].getClassName()
656  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
657  }
658 
659  @Override
660  public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
661  throws SQLException { // logger.debug("Entered");
662  throw new UnsupportedOperationException("Not supported yet,"
663  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
664  + " class:" + new Throwable().getStackTrace()[0].getClassName()
665  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
666  }
667 
668  @Override
669  public PreparedStatement prepareStatement(String sql, String[] columnNames)
670  throws SQLException { // logger.debug("Entered");
671  throw new UnsupportedOperationException("Not supported yet,"
672  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
673  + " class:" + new Throwable().getStackTrace()[0].getClassName()
674  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
675  }
676 
677  @Override
678  public Clob createClob() throws SQLException { // logger.debug("Entered");
679  throw new UnsupportedOperationException("Not supported yet,"
680  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
681  + " class:" + new Throwable().getStackTrace()[0].getClassName()
682  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
683  }
684 
685  @Override
686  public Blob createBlob() throws SQLException { // logger.debug("Entered");
687  throw new UnsupportedOperationException("Not supported yet,"
688  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
689  + " class:" + new Throwable().getStackTrace()[0].getClassName()
690  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
691  }
692 
693  @Override
694  public NClob createNClob() throws SQLException { // logger.debug("Entered");
695  throw new UnsupportedOperationException("Not supported yet,"
696  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
697  + " class:" + new Throwable().getStackTrace()[0].getClassName()
698  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
699  }
700 
701  @Override
702  public SQLXML createSQLXML() throws SQLException { // logger.debug("Entered");
703  throw new UnsupportedOperationException("Not supported yet,"
704  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
705  + " class:" + new Throwable().getStackTrace()[0].getClassName()
706  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
707  }
708 
709  @Override
710  public boolean isValid(int timeout) throws SQLException { // logger.debug("Entered");
711  try {
712  client.get_server_status(session);
713  } catch (TTransportException ex) {
714  throw new SQLException("Connection failed - " + ex.toString());
715  } catch (TMapDException ex) {
716  throw new SQLException("Connection failed - " + ex.toString());
717  } catch (TException ex) {
718  throw new SQLException("Connection failed - " + ex.toString());
719  }
720  return true;
721  }
722 
723  @Override
724  public void setClientInfo(String name, String value) throws SQLClientInfoException {
725  throw new UnsupportedOperationException("Not supported yet,"
726  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
727  + " class:" + new Throwable().getStackTrace()[0].getClassName()
728  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
729  }
730 
731  @Override
732  public void setClientInfo(Properties properties) throws SQLClientInfoException {
733  throw new UnsupportedOperationException("Not supported yet,"
734  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
735  + " class:" + new Throwable().getStackTrace()[0].getClassName()
736  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
737  }
738 
739  @Override
741  throws SQLException { // logger.debug("Entered");
742  throw new UnsupportedOperationException("Not supported yet,"
743  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
744  + " class:" + new Throwable().getStackTrace()[0].getClassName()
745  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
746  }
747 
748  @Override
749  public Properties getClientInfo() throws SQLException { // logger.debug("Entered");
750  throw new UnsupportedOperationException("Not supported yet,"
751  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
752  + " class:" + new Throwable().getStackTrace()[0].getClassName()
753  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
754  }
755 
756  @Override
757  public Array createArrayOf(String typeName, Object[] elements)
758  throws SQLException { // logger.debug("Entered");
759  throw new UnsupportedOperationException("Not supported yet,"
760  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
761  + " class:" + new Throwable().getStackTrace()[0].getClassName()
762  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
763  }
764 
765  @Override
766  public Struct createStruct(String typeName, Object[] attributes)
767  throws SQLException { // logger.debug("Entered");
768  throw new UnsupportedOperationException("Not supported yet,"
769  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
770  + " class:" + new Throwable().getStackTrace()[0].getClassName()
771  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
772  }
773 
774  @Override
775  public void setSchema(String schema) throws SQLException { // logger.debug("Entered");
776  throw new UnsupportedOperationException("Not supported yet,"
777  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
778  + " class:" + new Throwable().getStackTrace()[0].getClassName()
779  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
780  }
781 
782  @Override
783  public String getSchema() throws SQLException { // logger.debug("Entered");
784  throw new UnsupportedOperationException("Not supported yet,"
785  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
786  + " class:" + new Throwable().getStackTrace()[0].getClassName()
787  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
788  }
789 
790  @Override
791  public void abort(Executor executor) throws SQLException { // logger.debug("Entered");
792  throw new UnsupportedOperationException("Not supported yet,"
793  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
794  + " class:" + new Throwable().getStackTrace()[0].getClassName()
795  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
796  }
797 
798  @Override
799  public void setNetworkTimeout(Executor executor, int milliseconds)
800  throws SQLException { // logger.debug("Entered");
801  throw new UnsupportedOperationException("Not supported yet,"
802  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
803  + " class:" + new Throwable().getStackTrace()[0].getClassName()
804  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
805  }
806 
807  @Override
808  public int getNetworkTimeout() throws SQLException { // logger.debug("Entered");
809  throw new UnsupportedOperationException("Not supported yet,"
810  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
811  + " class:" + new Throwable().getStackTrace()[0].getClassName()
812  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
813  }
814 
815  @Override
816  public <T> T unwrap(Class<T> iface) throws SQLException { // logger.debug("Entered");
817  throw new UnsupportedOperationException("Not supported yet,"
818  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
819  + " class:" + new Throwable().getStackTrace()[0].getClassName()
820  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
821  }
822 
823  @Override
824  public boolean isWrapperFor(Class<?> iface)
825  throws SQLException { // logger.debug("Entered");
826  throw new UnsupportedOperationException("Not supported yet,"
827  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
828  + " class:" + new Throwable().getStackTrace()[0].getClassName()
829  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
830  }
831 }
public< T > T unwrap(Class< T > iface)
std::string filename(char const *path)
Definition: Logger.cpp:58
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
Connection_properties(Properties properties, String connection_url)
void setAutoCommit(boolean autoCommit)
static String getX509(X509Certificate cert)
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)
static S_struct getDetails_pkcs12(String filename, String password)
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)
EnumMap< Connection_enums, Param_pair > connection_map
PreparedStatement prepareStatement(String sql, int[] columnIndexes)
void setTypeMap(Map< String, Class<?>> map)