r-dbi / r-dbi/RPostgres

Connection attempt to arcadedb (supports the Postgres wire format for connection and queries) fails with "received invalid response to GSSAPI negotiation: R"

Open
#363 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
343
Forks
82
Avg merge
11h 26m
Merged PRs (30d)
9

Description

Attempting to connect to arcadedb which claims to support the Postgres wire format for connections and queries, an error "received invalid response to GSSAPI negotiation: R" appears.

Brief description of the problem

It appears as GSSAPI is used by default, which throws the error, but R hangs when I try to disable this when making a connection.

The RJDBC library is able to make a connection and read data from a table using the latest official Postgres JDBC-driver.

arcadedb_cmd <- paste(
  "docker run -d -p '2480:2480' -p '2424:2424' -p '5432:5432'",
  "--env arcadedb.server.rootPassword=playwithdata",
  "--env 'arcadedb.server.defaultDatabases=Imported[root]{import:https://github.
com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz}'", 
  "--env arcadedb.server.plugins='Postgres:com.arcadedb.postgres.PostgresProtoco
lPlugin'", 
  "arcadedata/arcadedb:latest"
)

cmd <- gsub("\n", "", arcadedb_cmd)

# launch the background service with arcadedb using docker
system(arcadedb_cmd)

# check that it is online using the API
arcadedb_is_up <- function() {
  
  res <- httr::content(
    httr::GET("http://localhost:2480/api/v1/databases", 
    httr::authenticate("root", "playwithdata"))
  )
  
  res$result[[1]] == "Imported"
}

stopifnot(arcadedb_is_up())

# use RJDBC and the pg jdbc driver

download.file(
  "https://jdbc.postgresql.org/download/postgresql-42.3.1.jar",
  "~/repos/arcadedb/postgresql-42.3.1.jar"
)

library(RJDBC)

drv <- JDBC(
  driverClass = "org.postgresql.Driver", 
  classPath = "~/repos/arcadedb/postgresql-42.3.1.jar", 
  identifier.quote = "`"
)

conn <- dbConnect(drv, 
  paste0("jdbc:postgresql://localhost/Imported",
    "?user=root&password=playwithdata&ssl=false&gssencmode=disable"))

tibble::as_tibble(dbGetQuery(conn, "select * from Brewery limit 10;"))

dbDisconnect(conn)

# Now, attempt to use RPostgres which uses libpg and no Java

library(RPostgres)
library(DBI)

#Sys.setenv(PGGSSENCMODE="disable")
Sys.unsetenv("PGGSSENCMODE")

con <- dbConnect(
  RPostgres::Postgres(),
#  gssencmode = 'disable',
  dbname = 'Imported',
  host = 'localhost',
  port = 5432, 
  user = 'root',
  password = 'playwithdata'
)

# Error: connection to server at "localhost" (127.0.0.1), port 5432 failed: received invalid response to GSSAPI negotiation: R

Related to https://github.com/r-dbi/RPostgres/issues/174 (but it seems I want to do the opposite and disable GSSAPI negotiation, and when trying to do so R hangs)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Arcadedb Docker setup with RPostgres::Postgres() and dbConnect(), testing the gssencmode and PGGSSENCMODE options mentioned in the issue. Review related issue #174 and compare against the working RJDBC connection; done means RPostgres can connect and query Arcadedb without the GSSAPI negotiation error or hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, r
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.