You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2017/10/01 02:10:17 UTC
[05/28] incubator-guacamole-client git commit: GUACAMOLE-363: Update
so that any of the available TDS-compatible drivers can be used.
GUACAMOLE-363: Update so that any of the available TDS-compatible drivers can be used.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b72dba6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b72dba6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b72dba6b
Branch: refs/heads/master
Commit: b72dba6b033a0da3c6bd8db248b848313dfe8fe9
Parents: d6d7c37
Author: Nick Couchman <vn...@apache.org>
Authored: Thu Sep 7 16:07:59 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Sep 28 07:00:52 2017 -0400
----------------------------------------------------------------------
.../SQLServerAuthenticationProviderModule.java | 15 +++++---
.../auth/sqlserver/SQLServerEnvironment.java | 39 ++++++++++++++++++--
.../sqlserver/SQLServerGuacamoleProperties.java | 6 +--
3 files changed, 49 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b72dba6b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
index d936f14..22c5434 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
@@ -44,8 +44,8 @@ public class SQLServerAuthenticationProviderModule implements Module {
/**
* Whether or not to use JTDS Driver
*/
- private Boolean useJTDSDriver = false;
-
+ private String sqlServerDriver;
+
/**
* Creates a new SQLServer authentication provider module that configures
* driver and MyBatis properties using the given environment.
@@ -75,8 +75,8 @@ public class SQLServerAuthenticationProviderModule implements Module {
// Use UTF-8 in database
driverProperties.setProperty("characterEncoding", "UTF-8");
- // Capture whether or not to use the JTDS driver.
- this.useJTDSDriver = environment.getSQLServerJTDSDriver();
+ // Capture which driver to use for the connection.
+ this.sqlServerDriver = environment.getSQLServerDriver();
}
@@ -84,8 +84,13 @@ public class SQLServerAuthenticationProviderModule implements Module {
public void configure(Binder binder) {
// Bind SQLServer-specific properties
- if (this.useJTDSDriver)
+ // Look at the property to choose the correct driver.
+ if (sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_JTDS))
JdbcHelper.SQL_Server_jTDS.configure(binder);
+ else if(sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_DATADIRECT))
+ JdbcHelper.SQL_Server_DataDirect.configure(binder);
+ else if(sqlServerDriver.equals(SQLServerEnvironment.SQLSERVER_DRIVER_MS))
+ JdbcHelper.SQL_Server_MS_Driver.configure(binder);
else
JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b72dba6b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
index 4d24dd3..2110b0c 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerEnvironment.java
@@ -97,6 +97,30 @@ public class SQLServerEnvironment extends JDBCEnvironment {
private int DEFAULT_MAX_GROUP_CONNECTIONS = 0;
/**
+ * The value for the sqlserver-driver property that triggers the use of
+ * the open source JTDS driver.
+ */
+ public final static String SQLSERVER_DRIVER_JTDS = "jtds";
+
+ /**
+ * The value for the sqlserver-driver property that triggers the use of
+ * the DataDirect JDBC driver.
+ */
+ public final static String SQLSERVER_DRIVER_DATADIRECT = "datadirect";
+
+ /**
+ * The value for the sqlserver-driver property that triggers the use of
+ * the older Microsoft JDBC driver.
+ */
+ public final static String SQLSERVER_DRIVER_MS = "microsoft";
+
+ /**
+ * The value for the sqlserver-driver property that triggers the use of
+ * the Microsoft JDBC driver. This is the default.
+ */
+ public final static String SQLSERVER_DRIVER_MS_2005 = "microsoft2005";
+
+ /**
* Constructs a new SQLServerEnvironment, providing access to SQLServer-specific
* configuration options.
*
@@ -169,6 +193,15 @@ public class SQLServerEnvironment extends JDBCEnvironment {
}
+ // Check driver property is one of the acceptable values.
+ String driver = getProperty(SQLServerGuacamoleProperties.SQLSERVER_DRIVER);
+ if (!(driver.equals(SQLSERVER_DRIVER_JTDS) ||
+ driver.equals(SQLSERVER_DRIVER_DATADIRECT) ||
+ driver.equals(SQLSERVER_DRIVER_MS) ||
+ driver.equals(SQLSERVER_DRIVER_MS_2005)))
+ logger.warn("{} property has been set to an invalid value. The default Microsoft 2005 driver will be used.",
+ SQLServerGuacamoleProperties.SQLSERVER_DRIVER.getName());
+
}
@Override
@@ -314,10 +347,10 @@ public class SQLServerEnvironment extends JDBCEnvironment {
* If an error occurs while retrieving the property value, or if the
* value was not set, as this property is required.
*/
- public Boolean getSQLServerJTDSDriver() throws GuacamoleException {
+ public String getSQLServerDriver() throws GuacamoleException {
return getProperty(
- SQLServerGuacamoleProperties.SQLSERVER_JTDS_DRIVER,
- false
+ SQLServerGuacamoleProperties.SQLSERVER_DRIVER,
+ SQLSERVER_DRIVER_MS_2005
);
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b72dba6b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
index d04d9a1..9d9b386 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerGuacamoleProperties.java
@@ -200,11 +200,11 @@ public class SQLServerGuacamoleProperties {
/**
* Whether or not to use the JTDS driver for SQL Server connections.
*/
- public static final BooleanGuacamoleProperty
- SQLSERVER_JTDS_DRIVER = new BooleanGuacamoleProperty() {
+ public static final StringGuacamoleProperty
+ SQLSERVER_DRIVER = new StringGuacamoleProperty() {
@Override
- public String getName() { return "sqlserver-use-jtds-driver"; }
+ public String getName() { return "sqlserver-driver"; }
};