mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-363: Allow use of alternate JTDS driver.
This commit is contained in:
@@ -41,6 +41,11 @@ public class SQLServerAuthenticationProviderModule implements Module {
|
||||
*/
|
||||
private final Properties driverProperties = new Properties();
|
||||
|
||||
/**
|
||||
* Whether or not to use JTDS Driver
|
||||
*/
|
||||
private Boolean useJTDSDriver = false;
|
||||
|
||||
/**
|
||||
* Creates a new SQLServer authentication provider module that configures
|
||||
* driver and MyBatis properties using the given environment.
|
||||
@@ -70,12 +75,18 @@ 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();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder) {
|
||||
|
||||
// Bind SQLServer-specific properties
|
||||
if (this.useJTDSDriver)
|
||||
JdbcHelper.SQL_Server_jTDS.configure(binder);
|
||||
else
|
||||
JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
|
||||
|
||||
// Bind MyBatis properties
|
||||
|
@@ -303,4 +303,22 @@ public class SQLServerEnvironment extends JDBCEnvironment {
|
||||
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_PASSWORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not to use the SourceForge JTDS driver for more
|
||||
* generic JTDS connections instead of the Microsoft-provided JDBC driver.
|
||||
*
|
||||
* @return
|
||||
* True if the JTDS driver should be used; false by default.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* 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 {
|
||||
return getProperty(
|
||||
SQLServerGuacamoleProperties.SQLSERVER_JTDS_DRIVER,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -197,4 +197,15 @@ public class SQLServerGuacamoleProperties {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether or not to use the JTDS driver for SQL Server connections.
|
||||
*/
|
||||
public static final BooleanGuacamoleProperty
|
||||
SQLSERVER_JTDS_DRIVER = new BooleanGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "sqlserver-use-jtds-driver"; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user