Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTful connection should allow user not specify database name #252

Closed
sangshuduo opened this issue Apr 24, 2023 · 0 comments
Closed

RESTful connection should allow user not specify database name #252

sangshuduo opened this issue Apr 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@sangshuduo
Copy link
Contributor

The RESTful connection allows users do not to specify the database name. But running the following code piece will get an error "no auth info input".

using IoTSharp.Data.Taos;

namespace Demo
{
    class Program
    {
        private static void Main()
        {
            var builder = new TaosConnectionStringBuilder()
            {
                DataSource = "127.0.0.1",
                           DataBase = null,
                           Username = "root",
                           Password = "taosdata",
                           Port = 6041,
                           Protocol = "RESTful"
            };

            string configDir = "/etc/taos";
            var connection = new TaosConnection(builder.ConnectionString, configDir);
            try
            {
                connection.Open();
                var cmd = connection.CreateCommand();
                cmd.CommandText = "show databases";
                var res = cmd.ExecuteReader();
                while (res.Read())
                {
                    Console.WriteLine(res.GetString(0));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                connection.Close();
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants