You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2015/08/25 23:29:12 UTC
[42/50] [abbrv] hive git commit: HIVE-11501 : Make
Connections.setReadOnly method compliant (Michal Wegrzyn via Sergey
Shelukhin)
HIVE-11501 : Make Connections.setReadOnly method compliant (Michal Wegrzyn via Sergey Shelukhin)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f7ebff00
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f7ebff00
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f7ebff00
Branch: refs/heads/llap
Commit: f7ebff0057c8b16f44d03feb96f8a58e2ee848b0
Parents: 2de6fda
Author: Michał Węgrzyn <mi...@gmail.com>
Authored: Sat Aug 8 10:27:35 2015 +0200
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Sun Aug 23 22:13:52 2015 -0700
----------------------------------------------------------------------
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/f7ebff00/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
index bb2b695..3b7e004 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
@@ -1279,8 +1279,16 @@ public class HiveConnection implements java.sql.Connection {
@Override
public void setReadOnly(boolean readOnly) throws SQLException {
- // TODO Auto-generated method stub
- throw new SQLException("Method not supported");
+ // Per JDBC spec, if the connection is closed a SQLException should be thrown.
+ if (isClosed) {
+ throw new SQLException("Connection is closed");
+ }
+ // Per JDBC spec, the request defines a hint to the driver to enable database optimizations.
+ // The read-only mode for this connection is disabled and cannot be enabled (isReadOnly always returns false).
+ // The most correct behavior is to throw only if the request tries to enable the read-only mode.
+ if(readOnly) {
+ throw new SQLException("Enabling read-only mode not supported");
+ }
}
/*