public void ChangeConfigOptions(ConfigOptions opts)
 {
     this.options = opts;
     Close();
     Connect();
 }
        //private readonly Logger logger = new Logger("IConnectionICPImpl");

        public ConnectionTCPImpl(ServerAddress addr, ConfigOptions opts)
        {
            this.hostAddress = addr;
            this.options = opts;
        }
예제 #3
0
        /** \fn void ChangeConnectionOptions(ConfigOptions opts)
         *  \brief Change the connection options
         *  \return void
         *  \param opts The connection options
         *  \exception System.Exception
         */
        public void ChangeConnectionOptions(ConfigOptions opts)
        {
            connection.ChangeConfigOptions(opts);
            try
            {
                Auth();
            }
            catch (BaseException e)
            {
                throw e;
            }

        }
예제 #4
0
 /** \fn void Connect(string username, string password, ConfigOptions options)
  *  \brief Connect to remote Sequoiadb database server
  *  \username Sequoiadb connection user name
  *  \password Sequoiadb connection password
  *  \options The options for connection
  *  \return void
  *  \exception SequoiaDB.BaseException
  *  \exception System.Exception
  */
 public void Connect(string username, string password, ConfigOptions options)
 {
     ConfigOptions opts = options;
     if (username == null)
         username = "";
     if (password == null)
         password = "";
     this.userName = username;
     this.password = password;
     if (options == null)
         opts = new ConfigOptions();
     if (connection == null)
     {
         // single address
         if (serverAddress != null)
         {
             // connect
             try
             {
                 connection = new ConnectionTCPImpl(serverAddress, opts);
                 connection.Connect();
             }
             catch (System.Exception e)
             {
                 connection = null;
                 throw e;
             }
         }
         // several addresses
         else if (serverAddresses != null)
         {
             int size = serverAddresses.Length;
             Random random = new Random();
             int count = random.Next(size);
             int mark = count;
             do
             {
                 count = ++count % size;
                 try
                 {
                     ServerAddress conn = serverAddresses[count];
                     connection = new ConnectionTCPImpl(conn, opts);
                     connection.Connect();
                 }
                 catch (System.Exception)
                 {
                     if (mark == count)
                     {
                         throw new BaseException("SDB_NET_CANNOT_CONNECT");
                     }
                     continue;
                 }
                 break;
             } while (mark != count);
         }
         else
         {
             throw new BaseException("SDB_NET_CANNOT_CONNECT");
         }
         // get endian info
         isBigEndian = RequestSysInfo();
         // authentication
         try
         {
             Auth();
         }
         catch (BaseException e)
         {
             throw e;
         }
     }
 }
예제 #5
0
 public void ChangeConfigOptions(ConfigOptions opts)
 {
     this.options = opts;
     Close();
     Connect();
 }
예제 #6
0
        //private readonly Logger logger = new Logger("IConnectionICPImpl");

        public ConnectionTCPImpl(ServerAddress addr, ConfigOptions opts)
        {
            this.hostAddress = addr;
            this.options     = opts;
        }