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;
        }
        /** \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;
            }

        }
 /** \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;
         }
     }
 }
Example #5
0
 public void ChangeConfigOptions(ConfigOptions opts)
 {
     this.options = opts;
     Close();
     Connect();
 }
Example #6
0
        //private readonly Logger logger = new Logger("IConnectionICPImpl");

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