Github user necouchman commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/182#discussion_r135949471
  
    --- Diff: 
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-sqlserver/src/main/java/org/apache/guacamole/auth/sqlserver/SQLServerAuthenticationProviderModule.java
 ---
    @@ -0,0 +1,91 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.guacamole.auth.sqlserver;
    +
    +import com.google.inject.Binder;
    +import com.google.inject.Module;
    +import com.google.inject.name.Names;
    +import java.util.Properties;
    +import org.apache.guacamole.GuacamoleException;
    +import org.mybatis.guice.datasource.helper.JdbcHelper;
    +
    +/**
    + * Guice module which configures SQLServer-specific injections.
    + */
    +public class SQLServerAuthenticationProviderModule implements Module {
    +
    +    /**
    +     * MyBatis-specific configuration properties.
    +     */
    +    private final Properties myBatisProperties = new Properties();
    +
    +    /**
    +     * SQLServer-specific driver configuration properties.
    +     */
    +    private final Properties driverProperties = new Properties();
    +    
    +    /**
    +     * Creates a new SQLServer authentication provider module that 
configures
    +     * driver and MyBatis properties using the given environment.
    +     *
    +     * @param environment
    +     *     The environment to use when configuring MyBatis and the 
underlying
    +     *     JDBC driver.
    +     *
    +     * @throws GuacamoleException
    +     *     If a required property is missing, or an error occurs while 
parsing
    +     *     a property.
    +     */
    +    public SQLServerAuthenticationProviderModule(SQLServerEnvironment 
environment)
    +            throws GuacamoleException {
    +
    +        // Set the SQLServer-specific properties for MyBatis.
    +        myBatisProperties.setProperty("mybatis.environment.id", 
"guacamole");
    +        myBatisProperties.setProperty("JDBC.host", 
environment.getSQLServerHostname());
    +        myBatisProperties.setProperty("JDBC.port", 
String.valueOf(environment.getSQLServerPort()));
    +        myBatisProperties.setProperty("JDBC.schema", 
environment.getSQLServerDatabase());
    +        myBatisProperties.setProperty("JDBC.username", 
environment.getSQLServerUsername());
    +        myBatisProperties.setProperty("JDBC.password", 
environment.getSQLServerPassword());
    +        myBatisProperties.setProperty("JDBC.autoCommit", "false");
    +        myBatisProperties.setProperty("mybatis.pooled.pingEnabled", 
"true");
    +        myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 
1");
    +
    +        // Use UTF-8 in database
    +        driverProperties.setProperty("characterEncoding", "UTF-8");
    +
    +    }
    +
    +    @Override
    +    public void configure(Binder binder) {
    +
    +        // Bind SQLServer-specific properties
    +        JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder);
    --- End diff --
    
    I'll have to give the SQL_Server_jTDS driver a try - I didn't even try that 
one.  I tried the SQL_Server_MS_Driver (sans 2005), and it had something silly 
like the order of the class name was slightly different 
(com.microsoft.sqlserver.jdbc vs. com.microsoft.jdbc.sqlserver).  I'll try the 
jTDS one and see what happens.  I'm using Microsoft's JAR file, so not sure if 
the jTDS one will require that, some other JAR file, or is all built in??  I'll 
find out, I guess.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to