Closed sundy-li closed 8 years ago
I am not using sql server, so is LinuxSQLDrivers(FreeTDS, Microsoft ODBC Driver) necessary ?
If you are not connecting to SQL Server, you should not need FreeTDS or Microsoft ODBC Driver.
Alex
@alexbrainman Thank you
I already config drill odbc by manual from https://drill.apache.org/docs/odbc-configuration-reference/
` , and It works fine as below
[root@sf41:/usr/local/drill/libiodbc-3.52.7]# samples/iodbctest
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0709.0909
Enter ODBC connect string (? shows list): dsn=drill
Driver: 1.2.1.1001 (MapR Drill ODBC Driver)
SQL>
But I wrote the code using the go odbc client, It does not work, here is my code
package main
import (
"database/sql"
"fmt"
_ "github.com/alexbrainman/odbc"
)
func main() {
db, err := sql.Open("odbc", "dsn=Drill")
if err != nil {
panic(err.Error())
}
rows, err := db.Query("select * from indexr.campaign limit 10")
if err != nil {
panic(err.Error())
}
for rows.Next() {
fmt.Println(rows.Columns())
}
}
[root@sf41:~]# go run ~/odbc.go
panic: SQLDriverConnect: {H} [unixODBC][ // I don't know where is the problem
And my config is as below
[root@sf41:~]# cat ~/.odbcinst.ini
[ODBC Drivers]
MapR Drill ODBC Driver 64-bit=Installed
[DrillDriver]
Description=MapR Drill ODBC Driver(64-bit)
Driver=/opt/mapr/drillodbc/lib/64/libmaprdrillodbc64.so
[root@sf41:~]# cat ~/.odbc.ini
[ODBC]
Trace=no
[ODBC Data Sources]
Sample MapR Drill DSN 64=MapR Drill ODBC Driver 64-bit
[Drill]
Description=MapR Drill ODBC Driver (64-bit) DSN
Driver=DrillDriver
ConnectionType=Zookeeper
HOST=
PORT=
ZKQuorum=sf51:2181,sf41:2181,sf42:2181
ZKClusterID=drillbits1
AuthenticationType=No Authentication
UID=[USERNAME]
PWD=[PASSWORD]
AdvancedProperties=CastAnyToVarchar=true;HandshakeTimeout=5;QueryTimeout=180;TimestampTZDisplayTimezone=utc;ExcludedSchemas=sys,INFORMATION_SCHEMA;NumberOfPrefetchBuffers=5;
Catalog=DRILL
Schema=
Could you please help me fix this problem? Thank you very much
My Host and Port is null, because drill is distribute and connected by zookeeper, is that the problem?
Sundy, I haven't used zookeeper yet. I've only used drill embedded thus far and am able to specify a host and port. Currently, I've been able to connect via this ODBC driver but need to do some conversion of the query string type as the Unicode string isn't working once it reaches my embedded drill server.
Not being able to specify a host and port for zookeeper is likely going to be a problem since the ODBC software won't be able to connect to anything.
Got that, thanks for your reply, I am looking forward that the odbc client will be better support in connecting zookeeper in the future ~~
@sundy-li and @ctownsen357 I am not sure if I can help here. I really don't see what the problem is. The ODBC connection string is something that only drill-odbc driver understands - it has nothing to do with my package.
My Host and Port is null, because drill is distribute and connected by zookeeper, is that the problem?
I suspect drill-odbc driver will require both Host and Port to be provided. I am not familiar with the driver, but it sounds reasonable to me.
but need to do some conversion of the query string type as the Unicode string isn't working once it reaches my embedded drill server.
I am not clear what you are saying here. If you're talking about SQL query strings, then these are utf16, and this is how ODBC is designed. So every ODBC driver must be able to handle SQL query strings in utf16. But, perhaps, you're talking about SQL column / result types. If you explain what the problem is, I might be able to help you here.
Alex
@alexbrainman, I agree, it is not a problem with your package. I relayed to @sundy-li that I had connected with your package but only in a single server embedded mode with Apache Drill and have not tried to connect to a distributed cluster of drill bits managed by zookeeper.
Closing this.
I am not using sql server, so is LinuxSQLDrivers(FreeTDS, Microsoft ODBC Driver) necessary ?