public void ReadStaticC(int v, TimeSpan ts)
        {
            VerticaConnectionStringBuilder builder = new VerticaConnectionStringBuilder();

            builder.Database = "mydb";
            builder.User     = "******";
            builder.Password = "******";
            builder.Host     = "10.58.44.163";
            VerticaConnection con = new VerticaConnection(builder.ToString());

            con.Open();
            StringBuilder  c       = new StringBuilder();
            string         content = PrepareReadMultiple(v, ts, c);
            VerticaCommand com     = new VerticaCommand(content);

            com.Connection = con;
            while (ReadTest.Running)
            {
                VerticaDataReader r = com.ExecuteReader();
                if (!r.HasRows)
                {
                    System.Console.WriteLine("Error: Vertica ReadMultiple received empty");
                }
                r.Close();
                System.Threading.Thread.Sleep(100);
            }
        }
示例#2
0
        public VerticaClient(string host, string database, string user, string password)
        {
            VerticaConnectionStringBuilder builder = new VerticaConnectionStringBuilder {
                Host     = host,
                Database = database,
                User     = user,
                Password = password
            };

            connection = new VerticaConnection(builder.ToString());
            IsConnectionOpened();
        }
        public VerticaClient(string host, string database, string user, string password, BackgroundWorker bw = null)
        {
            VerticaConnectionStringBuilder builder = new VerticaConnectionStringBuilder {
                Host     = host,
                Database = database,
                User     = user,
                Password = password
            };

            this.bw    = bw;
            connection = new VerticaConnection(builder.ToString());
            IsConnectionOpened();
        }
        public void SetDomainName(string domain)
        {
            DomainName = domain;
            VerticaConnectionStringBuilder builder = new VerticaConnectionStringBuilder();

            builder.Database = "mydb";
            builder.User     = "******";
            builder.Password = "******";
            builder.Host     = "10.58.44.163";
            builder.Pooling  = true;
            client           = new VerticaConnection(builder.ToString());
            client.Open();
        }
示例#5
0
        /// <summary>
        /// Builds a connection string for the passed in server identifier using global config values
        /// NOTE: Vertica does not have multiple databases per host so we
        /// have to use schemas as a logical separation for databases.
        /// Database name is configured in the config file
        /// </summary>
        /// <returns>An ADO.NET connection string</returns>
        private string buildConnString()
        {
            string host             = "";
            string user             = "";
            string password         = "";
            string label            = "";
            string isolationLevel   = "";
            string backupServerNode = "";
            string verticaDatabase  = "";
            int    port;
            int    connectionTimeout;
            bool   connectionLoadBalance;

            switch (server)
            {
            case TServer.SLAVE:
                host                  = Config.Slave;
                user                  = Config.SlaveUser;
                password              = (new cTripleDes().Decrypt(Config.SlavePassword));
                label                 = Config.VerticaLabel;
                isolationLevel        = Config.VerticaIsolationLevel;
                backupServerNode      = Config.VerticaBackupServerNode;
                verticaDatabase       = Config.VerticaDatabase;
                port                  = Config.VerticaPort;
                connectionTimeout     = Config.VerticaConnectionTimeout;
                connectionLoadBalance = Config.VerticaConnectionLoadBalance;
                break;

            default:
                throw new NotImplementedException("Vertica is only supported as a slave!");
            }
            VerticaConnectionStringBuilder builder = new VerticaConnectionStringBuilder();

            builder.Host                  = host;
            builder.Database              = verticaDatabase;
            builder.User                  = user;
            builder.Password              = password;
            builder.Label                 = label;
            builder.BackupServerNode      = backupServerNode;
            builder.Port                  = port;
            builder.ConnectionTimeout     = connectionTimeout;
            builder.ConnectionLoadBalance = connectionLoadBalance;
            try {
                builder.IsolationLevel = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), isolationLevel);
            } catch (Exception) {
                throw new Exception("Problem parsing Vertica connection isolation level");
            }

            return(builder.ToString());
        }