简体   繁体   中英

Connecting to an Azure SQL Server Data Warehouse from R on a Mac - See random names instead of tables

I'm trying to connect to an Azure SQL Server (12.00.1900) from R on a Mac, using Microsoft's unixodbc SQL Server drivers (17).

I get a connection, but instead of seeing the 12 or so tables that live in the database, dbListTables returns 442 tables, all with nonsensical names, beginning with 'Csoe', 'Ote', and ending in 'xlshm_idad'. Instead of seeing the single schema that lives in the database, I see cin_1mro__e , IFRAINSHM , and s , none of which have any tables in them.

Note that when I use an ordinary SQL visualization app, that doesn't use the MS drivers, I'm able to see the tables and their content properly.

In addition, the RSQLServer package gets a working connection and sees the tables correctly, but isn't compatible with dplyr semantics.

Can anyone help or advise? I've looked for third party SQL Server unixodbc drivers for Mac, and I can't find any.

Until I see more info from OP, I'll leave as my answer the general recommendation to use R's odbc package. Assuming the correct drivers are installed, connection is configured correctly in odbc.ini, and assuming trusted_connection=yes is used in the same, then connecting from R is as simple as:

library(odbc)
dbConn <- dbConnect(odbc(), dsn = "myDSN")

if trusted connection is not on then you just need to pass uid and pwd arguments.

Also, it may be the case OP that you did not install freeTDS, so try (replace with equivalent for package manager you're using):

brew install freetds --with-unixodbc

This gives you the libtdsodbc.so driver. Make sure the DSN points to this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM