java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Connection.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!“
     1 /**
     2  * SQL-DK
     3  * Copyright © 2014 František Kučera (frantovo.cz)
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, either version 3 of the License, or
     8  * (at your option) any later version.
     9  *
    10  * This program is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  * GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 package info.globalcode.jdbc.loopback;
    19 
    20 import java.sql.SQLClientInfoException;
    21 import java.sql.SQLException;
    22 import java.sql.SQLWarning;
    23 import java.sql.Savepoint;
    24 import java.util.Map;
    25 import java.util.Properties;
    26 import java.util.concurrent.Executor;
    27 
    28 /**
    29  *
    30  * @author Ing. František Kučera (frantovo.cz)
    31  */
    32 public class Connection extends AbstractConnection {
    33 
    34 	private String url;
    35 	private Properties info;
    36 
    37 	public Connection(String url, Properties info) {
    38 		this.url = url;
    39 		this.info = info;
    40 	}
    41 
    42 	@Override
    43 	public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException {
    44 		return new PreparedStatement();
    45 	}
    46 
    47 	@Override
    48 	public void setAutoCommit(boolean autoCommit) throws SQLException {
    49 	}
    50 
    51 	@Override
    52 	public boolean getAutoCommit() throws SQLException {
    53 		return true;
    54 	}
    55 
    56 	@Override
    57 	public void commit() throws SQLException {
    58 	}
    59 
    60 	@Override
    61 	public void rollback() throws SQLException {
    62 	}
    63 
    64 	@Override
    65 	public void close() throws SQLException {
    66 	}
    67 
    68 	@Override
    69 	public boolean isClosed() throws SQLException {
    70 		return false;
    71 	}
    72 
    73 	@Override
    74 	public void setReadOnly(boolean readOnly) throws SQLException {
    75 	}
    76 
    77 	@Override
    78 	public boolean isReadOnly() throws SQLException {
    79 		return true;
    80 	}
    81 
    82 	@Override
    83 	public void setCatalog(String catalog) throws SQLException {
    84 	}
    85 
    86 	@Override
    87 	public void setTransactionIsolation(int level) throws SQLException {
    88 	}
    89 
    90 	@Override
    91 	public SQLWarning getWarnings() throws SQLException {
    92 		return null;
    93 	}
    94 
    95 	@Override
    96 	public void clearWarnings() throws SQLException {
    97 	}
    98 
    99 	@Override
   100 	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
   101 	}
   102 
   103 	@Override
   104 	public void setHoldability(int holdability) throws SQLException {
   105 	}
   106 
   107 	@Override
   108 	public void rollback(Savepoint savepoint) throws SQLException {
   109 	}
   110 
   111 	@Override
   112 	public void releaseSavepoint(Savepoint savepoint) throws SQLException {
   113 	}
   114 
   115 	@Override
   116 	public boolean isValid(int timeout) throws SQLException {
   117 		return true;
   118 	}
   119 
   120 	@Override
   121 	public void setClientInfo(String name, String value) throws SQLClientInfoException {
   122 	}
   123 
   124 	@Override
   125 	public void setClientInfo(Properties properties) throws SQLClientInfoException {
   126 	}
   127 
   128 	@Override
   129 	public void abort(Executor executor) throws SQLException {
   130 	}
   131 
   132 	@Override
   133 	public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
   134 	}
   135 }