Is there any way to connect RStudio to SQLPLUS on RHEL8?

I am trying to connect SQLPlus/Oracle to RStudio on RHEL8 (using Oracle 12c) using odbc and/or jdbc drivers, without success (but with lots of frustration). I have tried installing multiple drivers and am running into all sorts of issues and no success.

Here is the R code I have tried, along with the current errors I've received with each attempt:

  1. Using a JDBC driver through Wildfly interface:
jdbcDriver = JDBC("oracle.jdbc.OracleDriver", classPath = "/opt/wildfly/modules/system/layers/base/com/oracle/main/ojdbc8.jar")
jdbcConnection = dbConnect(jdbcDriver, "jdbc:oracle:thin:@//[server.address.0.0]:1521/@SID", "username", "password")

That code has received this response:

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
   java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
  1. Second attempt using ODBC:
options(database_userid = "username")
con <- DBI::dbConnect(odbc::odbc(), 
    DSN = "ODBC Driver 17 for SQL Server",
    driver = "/opt/microsoft/msodbcsql17/lib64/",
    Server = "server.address.0.0",
    servername = "servername",
    protocol = "TCP",
    port = "1522"
    Database = "databasename"
    uid = getOption("database_userid"),
    SID = "@SID",
    trusted_connection = 'yes')

This comes back with the following error:

Error: nanodbc/nanodbc.cpp:983: 00000: [Microsoft][ODBC Driver for SQL Server] Login timeout expired [Microsoft][ODBC Driver 17 for SQL Server] TCP Provider: Error code 0x2749 [Microsoft][ODBC Driver 17 for SQL Server]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 conenctions. For more information see SQL Server Books Online. [Microsoft][ODBC Driver 17 for SQL Server] Invalid connection string attribute

I have tried following up on each of these leads with no success. On the terminal side I have tried to check the drivers using isql, and have received the error [ISQL]ERROR: Could not SQLConnect with every variation of isql code, drivers, etc. I could imagine and find online.

Any help would be appreciated.
I can get into SQLPlus just fine through the command line, I just cant seem to figure out how to connect it to R or to even verify that it is connected to a driver.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.