I don't know where are my code error. I created a datasource and after included in a RODBC function.
The datasource configuration is:
- Name: sqldatabases
- Driver: SQL Server Native Client 11.0
- Server: BRDCVMDB01
- Database in SQL Server: ANALYTICS_FA_CP_SPRO
I hope you can help me!
Thank you!
First Attempt
library(RODBC)
connect <- odbcDriverConnect(connection="Driver={SQL Server Native Client 11.0};server=sqldatabases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;")
Warning messages: 1: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=databases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : [RODBC] ERROR: state 08001, code 53, message [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. 2: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=databases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : [RODBC] ERROR: state HYT00, code 0, message [Microsoft][SQL Server Native Client 11.0]Login timeout expired 3: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=databases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : [RODBC] ERROR: state 08001, code 53, message [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. 4: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=databases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : ODBC connection failed
2nd Attempt
cn <- odbcDriverConnect(connection="Driver={SQL Server Native Client 11.0};server=BRDCVMDB01;database=databases;trusted_connection=yes;")
Warning messages: 1: In for (i in seq_along(args)) { : closing unused RODBC handle 14 2: In for (i in seq_along(args)) { : closing unused RODBC handle 12 3: In for (i in seq_along(args)) { : closing unused RODBC handle 8 4: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=BRDCVMDB01;database=databases;trusted_connection=yes;") : [RODBC] ERROR: state 28000, code 18456, message [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'ATRAME\mjordao'. 5: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=BRDCVMDB01;database=databases;trusted_connection=yes;") : [RODBC] ERROR: state 42000, code 4060, message [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "databases" requested by the login. The login failed. 6: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=BRDCVMDB01;database=databases;trusted_connection=yes;") : ODBC connection failed
3rd Attempt
cn <- odbcDriverConnect(connection="Driver={SQL Server Native Client 11.0};server=BRDCVMDB01;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;")
cn <- odbcDriverConnect(connection="Driver={SQL Server Native Client 11.0};server=sqldatabases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;")
Warning messages: 1: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=sqldatabases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : [RODBC] ERROR: state 08001, code 53, message [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. 2: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=sqldatabases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : [RODBC] ERROR: state HYT00, code 0, message [Microsoft][SQL Server Native Client 11.0]Login timeout expired 3: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=sqldatabases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : [RODBC] ERROR: state 08001, code 53, message [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. 4: In odbcDriverConnect(connection = "Driver={SQL Server Native Client 11.0};server=sqldatabases;database=ANALYTICS_FA_CP_SPRO;trusted_connection=yes;") : ODBC connection failed
trusted_connection =no
. Sometimes its kind of wacky in R. Also, if you are running this in Linux, use ipaddress instead ofsqldatabases
– Not_Dave