Closed art-korn-39 closed 3 months ago
How could I set driver in connection parameters?
this works:
connInfo := fmt.Sprintf("driver=ClickHouse ODBC Driver (Unicode);host=%s;port=%d;username=%s;password=%s;dbname=%s", cfg.CH_host, cfg.CH_port, cfg.CH_user, cfg.CH_password, cfg.CH_name) db, err = sqlx.Connect("odbc", connInfo) if err != nil { return err }
because I can explicitly specify the driver
but the structure clickhouse.Options{} does not have a single suitable field to indicate the driver
conn, err := clickhouse.Open(&clickhouse.Options{ Addr: []string{fmt.Sprintf("%s:%d", cfg.CH_host, cfg.CH_port)}, Auth: clickhouse.Auth{ Database: cfg.CH_name, Username: cfg.CH_user, Password: cfg.CH_password, }, Settings: clickhouse.Settings{ "driver": "ClickHouse ODBC Driver (Unicode)", }, }) if err != nil { return err } ctx := context.Background() return conn.Ping(ctx)
always error: [handshake] unexpected packet [72] from server
packages: _ "github.com/alexbrainman/odbc" "github.com/jmoiron/sqlx" "github.com/ClickHouse/clickhouse-go/v2"
@art-korn-39, why would you want to setup ODBC driver along with clickhouse-go? ClickHouse-go supports native TCP and HTTP protocols only.
How could I set driver in connection parameters?
this works:
because I can explicitly specify the driver
but the structure clickhouse.Options{} does not have a single suitable field to indicate the driver
always error: [handshake] unexpected packet [72] from server
packages: _ "github.com/alexbrainman/odbc" "github.com/jmoiron/sqlx" "github.com/ClickHouse/clickhouse-go/v2"