Skip to content

Instantly share code, notes, and snippets.

@naren-dremio
Created October 6, 2020 16:50
Show Gist options
  • Save naren-dremio/f961e3313b83e1e69cff0ec834fa09db to your computer and use it in GitHub Desktop.
Save naren-dremio/f961e3313b83e1e69cff0ec834fa09db to your computer and use it in GitHub Desktop.
dremio
%scala
Class.forName("com.dremio.jdbc.Driver")
val jdbcPort = 31010
val jdbcDatabase = "DREMIO"
val user = ""
val password = ""
val tbl = "postgres.public.actor"
// Create the JDBC URL without passing in the user and password parameters.
val jdbcUrl = "jdbc:dremio:direct=<HOST>:31010"
// Create a Properties() object to hold the parameters.
import java.util.Properties
val connectionProperties = new Properties()
connectionProperties.put("user", user)
connectionProperties.put("password", password)
val driverClass = "com.dremio.jdbc.Driver"
connectionProperties.setProperty("Driver", driverClass)
val employees_table = spark.read.jdbc(jdbcUrl, tbl, connectionProperties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment