java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractConnection.java
author František Kučera <franta-hg@frantovo.cz>
Tue, 26 Feb 2019 18:19:49 +0100
branchv_0
changeset 236 a3ec71fa8e17
parent 171 701ec4db43fb
permissions -rw-r--r--
Avoid reusing/rewriting the DB connection properties.
There was weird random errors while testing connection to multiple DB in parallel when one of them was meta connection to same DB connection.
Two kinds of exception: 1) missing password 2) „Passing DB password as CLI parameter is insecure!“
franta-hg@171
     1
/**
franta-hg@171
     2
 * SQL-DK
franta-hg@171
     3
 * Copyright © 2014 František Kučera (frantovo.cz)
franta-hg@171
     4
 *
franta-hg@171
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@171
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@171
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@171
     8
 * (at your option) any later version.
franta-hg@171
     9
 *
franta-hg@171
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@171
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@171
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@171
    13
 * GNU General Public License for more details.
franta-hg@171
    14
 *
franta-hg@171
    15
 * You should have received a copy of the GNU General Public License
franta-hg@171
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@171
    17
 */
franta-hg@171
    18
package info.globalcode.jdbc.loopback;
franta-hg@171
    19
franta-hg@171
    20
import java.sql.Array;
franta-hg@171
    21
import java.sql.Blob;
franta-hg@171
    22
import java.sql.CallableStatement;
franta-hg@171
    23
import java.sql.Clob;
franta-hg@171
    24
import java.sql.DatabaseMetaData;
franta-hg@171
    25
import java.sql.NClob;
franta-hg@171
    26
import java.sql.SQLClientInfoException;
franta-hg@171
    27
import java.sql.SQLException;
franta-hg@171
    28
import java.sql.SQLWarning;
franta-hg@171
    29
import java.sql.SQLXML;
franta-hg@171
    30
import java.sql.Savepoint;
franta-hg@171
    31
import java.sql.Struct;
franta-hg@171
    32
import java.util.Map;
franta-hg@171
    33
import java.util.Properties;
franta-hg@171
    34
import java.util.concurrent.Executor;
franta-hg@171
    35
franta-hg@171
    36
/**
franta-hg@171
    37
 *
franta-hg@171
    38
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@171
    39
 */
franta-hg@171
    40
public abstract class AbstractConnection implements java.sql.Connection {
franta-hg@171
    41
franta-hg@171
    42
	@Override
franta-hg@171
    43
	public java.sql.Statement createStatement() throws SQLException {
franta-hg@171
    44
		throw new SQLException("Not supported yet.");
franta-hg@171
    45
	}
franta-hg@171
    46
franta-hg@171
    47
	@Override
franta-hg@171
    48
	public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException {
franta-hg@171
    49
		throw new SQLException("Not supported yet.");
franta-hg@171
    50
	}
franta-hg@171
    51
franta-hg@171
    52
	@Override
franta-hg@171
    53
	public CallableStatement prepareCall(String sql) throws SQLException {
franta-hg@171
    54
		throw new SQLException("Not supported yet.");
franta-hg@171
    55
	}
franta-hg@171
    56
franta-hg@171
    57
	@Override
franta-hg@171
    58
	public String nativeSQL(String sql) throws SQLException {
franta-hg@171
    59
		throw new SQLException("Not supported yet.");
franta-hg@171
    60
	}
franta-hg@171
    61
franta-hg@171
    62
	@Override
franta-hg@171
    63
	public void setAutoCommit(boolean autoCommit) throws SQLException {
franta-hg@171
    64
		throw new SQLException("Not supported yet.");
franta-hg@171
    65
	}
franta-hg@171
    66
franta-hg@171
    67
	@Override
franta-hg@171
    68
	public boolean getAutoCommit() throws SQLException {
franta-hg@171
    69
		throw new SQLException("Not supported yet.");
franta-hg@171
    70
	}
franta-hg@171
    71
franta-hg@171
    72
	@Override
franta-hg@171
    73
	public void commit() throws SQLException {
franta-hg@171
    74
		throw new SQLException("Not supported yet.");
franta-hg@171
    75
	}
franta-hg@171
    76
franta-hg@171
    77
	@Override
franta-hg@171
    78
	public void rollback() throws SQLException {
franta-hg@171
    79
		throw new SQLException("Not supported yet.");
franta-hg@171
    80
	}
franta-hg@171
    81
franta-hg@171
    82
	@Override
franta-hg@171
    83
	public void close() throws SQLException {
franta-hg@171
    84
		throw new SQLException("Not supported yet.");
franta-hg@171
    85
	}
franta-hg@171
    86
franta-hg@171
    87
	@Override
franta-hg@171
    88
	public boolean isClosed() throws SQLException {
franta-hg@171
    89
		throw new SQLException("Not supported yet.");
franta-hg@171
    90
	}
franta-hg@171
    91
franta-hg@171
    92
	@Override
franta-hg@171
    93
	public DatabaseMetaData getMetaData() throws SQLException {
franta-hg@171
    94
		throw new SQLException("Not supported yet.");
franta-hg@171
    95
	}
franta-hg@171
    96
franta-hg@171
    97
	@Override
franta-hg@171
    98
	public void setReadOnly(boolean readOnly) throws SQLException {
franta-hg@171
    99
		throw new SQLException("Not supported yet.");
franta-hg@171
   100
	}
franta-hg@171
   101
franta-hg@171
   102
	@Override
franta-hg@171
   103
	public boolean isReadOnly() throws SQLException {
franta-hg@171
   104
		throw new SQLException("Not supported yet.");
franta-hg@171
   105
	}
franta-hg@171
   106
franta-hg@171
   107
	@Override
franta-hg@171
   108
	public void setCatalog(String catalog) throws SQLException {
franta-hg@171
   109
		throw new SQLException("Not supported yet.");
franta-hg@171
   110
	}
franta-hg@171
   111
franta-hg@171
   112
	@Override
franta-hg@171
   113
	public String getCatalog() throws SQLException {
franta-hg@171
   114
		throw new SQLException("Not supported yet.");
franta-hg@171
   115
	}
franta-hg@171
   116
franta-hg@171
   117
	@Override
franta-hg@171
   118
	public void setTransactionIsolation(int level) throws SQLException {
franta-hg@171
   119
		throw new SQLException("Not supported yet.");
franta-hg@171
   120
	}
franta-hg@171
   121
franta-hg@171
   122
	@Override
franta-hg@171
   123
	public int getTransactionIsolation() throws SQLException {
franta-hg@171
   124
		throw new SQLException("Not supported yet.");
franta-hg@171
   125
	}
franta-hg@171
   126
franta-hg@171
   127
	@Override
franta-hg@171
   128
	public SQLWarning getWarnings() throws SQLException {
franta-hg@171
   129
		throw new SQLException("Not supported yet.");
franta-hg@171
   130
	}
franta-hg@171
   131
franta-hg@171
   132
	@Override
franta-hg@171
   133
	public void clearWarnings() throws SQLException {
franta-hg@171
   134
		throw new SQLException("Not supported yet.");
franta-hg@171
   135
	}
franta-hg@171
   136
franta-hg@171
   137
	@Override
franta-hg@171
   138
	public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
franta-hg@171
   139
		throw new SQLException("Not supported yet.");
franta-hg@171
   140
	}
franta-hg@171
   141
franta-hg@171
   142
	@Override
franta-hg@171
   143
	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
franta-hg@171
   144
		throw new SQLException("Not supported yet.");
franta-hg@171
   145
	}
franta-hg@171
   146
franta-hg@171
   147
	@Override
franta-hg@171
   148
	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
franta-hg@171
   149
		throw new SQLException("Not supported yet.");
franta-hg@171
   150
	}
franta-hg@171
   151
franta-hg@171
   152
	@Override
franta-hg@171
   153
	public Map<String, Class<?>> getTypeMap() throws SQLException {
franta-hg@171
   154
		throw new SQLException("Not supported yet.");
franta-hg@171
   155
	}
franta-hg@171
   156
franta-hg@171
   157
	@Override
franta-hg@171
   158
	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
franta-hg@171
   159
		throw new SQLException("Not supported yet.");
franta-hg@171
   160
	}
franta-hg@171
   161
franta-hg@171
   162
	@Override
franta-hg@171
   163
	public void setHoldability(int holdability) throws SQLException {
franta-hg@171
   164
		throw new SQLException("Not supported yet.");
franta-hg@171
   165
	}
franta-hg@171
   166
franta-hg@171
   167
	@Override
franta-hg@171
   168
	public int getHoldability() throws SQLException {
franta-hg@171
   169
		throw new SQLException("Not supported yet.");
franta-hg@171
   170
	}
franta-hg@171
   171
franta-hg@171
   172
	@Override
franta-hg@171
   173
	public Savepoint setSavepoint() throws SQLException {
franta-hg@171
   174
		throw new SQLException("Not supported yet.");
franta-hg@171
   175
	}
franta-hg@171
   176
franta-hg@171
   177
	@Override
franta-hg@171
   178
	public Savepoint setSavepoint(String name) throws SQLException {
franta-hg@171
   179
		throw new SQLException("Not supported yet.");
franta-hg@171
   180
	}
franta-hg@171
   181
franta-hg@171
   182
	@Override
franta-hg@171
   183
	public void rollback(Savepoint savepoint) throws SQLException {
franta-hg@171
   184
		throw new SQLException("Not supported yet.");
franta-hg@171
   185
	}
franta-hg@171
   186
franta-hg@171
   187
	@Override
franta-hg@171
   188
	public void releaseSavepoint(Savepoint savepoint) throws SQLException {
franta-hg@171
   189
		throw new SQLException("Not supported yet.");
franta-hg@171
   190
	}
franta-hg@171
   191
franta-hg@171
   192
	@Override
franta-hg@171
   193
	public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
franta-hg@171
   194
		throw new SQLException("Not supported yet.");
franta-hg@171
   195
	}
franta-hg@171
   196
franta-hg@171
   197
	@Override
franta-hg@171
   198
	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
franta-hg@171
   199
		throw new SQLException("Not supported yet.");
franta-hg@171
   200
	}
franta-hg@171
   201
franta-hg@171
   202
	@Override
franta-hg@171
   203
	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
franta-hg@171
   204
		throw new SQLException("Not supported yet.");
franta-hg@171
   205
	}
franta-hg@171
   206
franta-hg@171
   207
	@Override
franta-hg@171
   208
	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
franta-hg@171
   209
		throw new SQLException("Not supported yet.");
franta-hg@171
   210
	}
franta-hg@171
   211
franta-hg@171
   212
	@Override
franta-hg@171
   213
	public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
franta-hg@171
   214
		throw new SQLException("Not supported yet.");
franta-hg@171
   215
	}
franta-hg@171
   216
franta-hg@171
   217
	@Override
franta-hg@171
   218
	public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
franta-hg@171
   219
		throw new SQLException("Not supported yet.");
franta-hg@171
   220
	}
franta-hg@171
   221
franta-hg@171
   222
	@Override
franta-hg@171
   223
	public Clob createClob() throws SQLException {
franta-hg@171
   224
		throw new SQLException("Not supported yet.");
franta-hg@171
   225
	}
franta-hg@171
   226
franta-hg@171
   227
	@Override
franta-hg@171
   228
	public Blob createBlob() throws SQLException {
franta-hg@171
   229
		throw new SQLException("Not supported yet.");
franta-hg@171
   230
	}
franta-hg@171
   231
franta-hg@171
   232
	@Override
franta-hg@171
   233
	public NClob createNClob() throws SQLException {
franta-hg@171
   234
		throw new SQLException("Not supported yet.");
franta-hg@171
   235
	}
franta-hg@171
   236
franta-hg@171
   237
	@Override
franta-hg@171
   238
	public SQLXML createSQLXML() throws SQLException {
franta-hg@171
   239
		throw new SQLException("Not supported yet.");
franta-hg@171
   240
	}
franta-hg@171
   241
franta-hg@171
   242
	@Override
franta-hg@171
   243
	public boolean isValid(int timeout) throws SQLException {
franta-hg@171
   244
		throw new SQLException("Not supported yet.");
franta-hg@171
   245
	}
franta-hg@171
   246
franta-hg@171
   247
	@Override
franta-hg@171
   248
	public void setClientInfo(String name, String value) throws SQLClientInfoException {
franta-hg@171
   249
		throw new SQLClientInfoException("Not supported yet.", null);
franta-hg@171
   250
	}
franta-hg@171
   251
franta-hg@171
   252
	@Override
franta-hg@171
   253
	public void setClientInfo(Properties properties) throws SQLClientInfoException {
franta-hg@171
   254
		throw new SQLClientInfoException("Not supported yet.", null);
franta-hg@171
   255
	}
franta-hg@171
   256
franta-hg@171
   257
	@Override
franta-hg@171
   258
	public String getClientInfo(String name) throws SQLException {
franta-hg@171
   259
		throw new SQLException("Not supported yet.");
franta-hg@171
   260
	}
franta-hg@171
   261
franta-hg@171
   262
	@Override
franta-hg@171
   263
	public Properties getClientInfo() throws SQLException {
franta-hg@171
   264
		throw new SQLException("Not supported yet.");
franta-hg@171
   265
	}
franta-hg@171
   266
franta-hg@171
   267
	@Override
franta-hg@171
   268
	public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
franta-hg@171
   269
		throw new SQLException("Not supported yet.");
franta-hg@171
   270
	}
franta-hg@171
   271
franta-hg@171
   272
	@Override
franta-hg@171
   273
	public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
franta-hg@171
   274
		throw new SQLException("Not supported yet.");
franta-hg@171
   275
	}
franta-hg@171
   276
franta-hg@171
   277
	@Override
franta-hg@171
   278
	public void setSchema(String schema) throws SQLException {
franta-hg@171
   279
		throw new SQLException("Not supported yet.");
franta-hg@171
   280
	}
franta-hg@171
   281
franta-hg@171
   282
	@Override
franta-hg@171
   283
	public String getSchema() throws SQLException {
franta-hg@171
   284
		throw new SQLException("Not supported yet.");
franta-hg@171
   285
	}
franta-hg@171
   286
franta-hg@171
   287
	@Override
franta-hg@171
   288
	public void abort(Executor executor) throws SQLException {
franta-hg@171
   289
		throw new SQLException("Not supported yet.");
franta-hg@171
   290
	}
franta-hg@171
   291
franta-hg@171
   292
	@Override
franta-hg@171
   293
	public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
franta-hg@171
   294
		throw new SQLException("Not supported yet.");
franta-hg@171
   295
	}
franta-hg@171
   296
franta-hg@171
   297
	@Override
franta-hg@171
   298
	public int getNetworkTimeout() throws SQLException {
franta-hg@171
   299
		throw new SQLException("Not supported yet.");
franta-hg@171
   300
	}
franta-hg@171
   301
franta-hg@171
   302
	@Override
franta-hg@171
   303
	public <T> T unwrap(Class<T> iface) throws SQLException {
franta-hg@171
   304
		throw new SQLException("Not supported yet.");
franta-hg@171
   305
	}
franta-hg@171
   306
franta-hg@171
   307
	@Override
franta-hg@171
   308
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
franta-hg@171
   309
		throw new SQLException("Not supported yet.");
franta-hg@171
   310
	}
franta-hg@171
   311
}