예제 #1
0
            /// <summary>
            /// Gets an HSQL protocol client session using the given properties.
            /// </summary>
            /// <param name="properties">The properties.</param>
            /// <param name="tls">
            /// If set to <c>true</c>, the session uses transport layer security.
            /// </param>
            /// <returns>an HSQL protocol client session</returns>
            internal static HsqlSession NewHsqlClientSession(
                HsqlProperties properties,
                bool tls)
            {
                if (properties == null)
                {
                    throw new ArgumentNullException("properties");
                }

                TranslateProperties(properties);

                string user     = properties.getProperty("user");
                string password = properties.getProperty("password");
                string host     = properties.getProperty("host");
                int    port     = properties.getIntegerProperty("port", 0);
                string path     = properties.getProperty("path");
                string database = properties.getProperty("database");

                try
                {
                    //Console.WriteLine(
                    //    "GetHsqlClientSession : host {0}, port {1}, database {2}, tls {3}",
                    //    host,
                    //    port,
                    //    database,
                    //    tls);

                    ISession session = new HsqlTcpClient(
                        host,
                        port,
                        path,
                        database,
                        tls,
                        user,
                        password);

                    return(new HsqlSession(session));
                }
                catch (org.hsqldb.HsqlException e)
                {
                    throw new HsqlDataSourceException(e);
                }
            }
            /// <summary>
            /// Gets an HSQL protocol client session using the given properties.
            /// </summary>
            /// <param name="properties">The properties.</param>
            /// <param name="tls">
            /// If set to <c>true</c>, the session uses transport layer security.
            /// </param>
            /// <returns>an HSQL protocol client session</returns>
            internal static HsqlSession NewHsqlClientSession(
                HsqlProperties properties,
                bool tls)
            {
                if (properties == null)
                {
                    throw new ArgumentNullException("properties");
                }

                TranslateProperties(properties);

                string user = properties.getProperty("user");
                string password = properties.getProperty("password");
                string host = properties.getProperty("host");
                int port = properties.getIntegerProperty("port", 0);
                string path = properties.getProperty("path");
                string database = properties.getProperty("database");

                try
                {

                    //Console.WriteLine(
                    //    "GetHsqlClientSession : host {0}, port {1}, database {2}, tls {3}",
                    //    host,
                    //    port,
                    //    database,
                    //    tls);

                    ISession session = new HsqlTcpClient(
                        host,
                        port,
                        path,
                        database,
                        tls,
                        user,
                        password);

                    return new HsqlSession(session);
                }
                catch (org.hsqldb.HsqlException e)
                {
                    throw new HsqlDataSourceException(e);
                }
            }