GithubHelp home page GithubHelp logo

Cannot connect to SQL database about rocker HOT 4 CLOSED

ShuAiii avatar ShuAiii commented on June 29, 2024
Cannot connect to SQL database

from rocker.

Comments (4)

ShuAiii avatar ShuAiii commented on June 29, 2024 1

okay, thanks anyways. Closing this issue as the driver is out of the scope of r-ocker.

from rocker.

eddelbuettel avatar eddelbuettel commented on June 29, 2024

R and Python likely used different way to configure the ODBC driver so the fact that one works and the other doesn't ... mostly says that you configure one and not the other.

We covered this here in issues before. Rocker is more or less a 'base layer' on top of which you can add packages and configurations to fit your needs. We cannot possibly cover all possible database connection.

Also, if you can, a 'direct' connections (say: RMariaDB to a MariaDB instance, or RPostgreSQL to Postgres, ...) will always outperform ODBC which needs extra drivers on both sides and config.

from rocker.

ShuAiii avatar ShuAiii commented on June 29, 2024

@eddelbuettel I apologize for the prolong reply, for some reason I did not get a notification.

  1. Can you refer me to the issue that was covered in the past?

  2. I installed additional dependencies on top of the base-image, such as unixodbc-dev, unixodbc, and libpq-dev.
    When you say most likely because I configured one and not the other. In R console, I see this:

> odbc::odbcListDrivers()
                           name   attribute
1 ODBC Driver 17 for SQL Server Description
2 ODBC Driver 17 for SQL Server      Driver
3 ODBC Driver 17 for SQL Server  UsageCount
                                                       value
1                    Microsoft ODBC Driver 17 for SQL Server
2 /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.1.1
3                                                          1

And in my /etc/odbcinst.ini I see this:

[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.10.so.1.1
UsageCount=1

and I'm attemping to connect to the DB like this:

database <- dbConnect(
      odbc::odbc(),
      dsn = "my-dsn",
      Database = "my-db",
      Driver = "ODBC Driver 17 for SQL Server",
      uid = "my-uid",
      pwd = "my-pw"
  )

I'm a novice at using R, any obvious configuration error you see?

from rocker.

eddelbuettel avatar eddelbuettel commented on June 29, 2024

I would recommend establishing a working use case outside the container first. Identify what the container needs, add it, and configure inside a (derived) container.

The last time I worked with SQL Server from R (over a decade ago) it did not have the linux drivers and one had to cheat vis the FreeTDS driver which had its own set of issues. I do not have a SQL Server sitting anywhere so I cannot help you with anything concrete.

from rocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.