Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
- java.sql.SQLException: NL Exception was generated
- caesi <- function(DB){
- ## Create an Oracle connection to a
- ## remote database using the SID in the connect string.
- drv <- JDBC(driverClass="oracle.jdbc.OracleDriver", classPath="E:/filelocation/ojdbc6.jar")
- ## user details
- username = "USERNAME" ## Your user name
- password = "PASSWORD" ## Your password
- ## Refer to Oracle Database Net Services Administator's Guide for
- ## details on connect string specification.
- ## Current connection string this will change when we replatform
- host <- "LOCALHOST"
- port <- 1521
- svc <- "rtreports"
- connect.string <- paste("(DESCRIPTION=", " (ADDRESS= (PROTOCOL=TCP)(HOST= ",host,")(PORT=",port,"))","(CONNECT_DATA= (SERVICE_NAME=",svc,")))",sep = "")
- ## Use username/password authentication.
- ErrReturn <- 0
- return({
- con <-dbConnect(drv,paste0("jdbc:oracle:thin:@localhost:1521:orcll",connect.string),username, password)
- })
- }
- Get_Data = function(){
- ch_or <- caesi("DB")
- data <- dbGetQuery(ch_or, paste0(("SELECT * FROM MYTABLE")))
- dbDisconnect(ch_or)
- outcoords <- data
- return(outcoords)
- }
- #
- library(tidyverse)
- library(RJDBC)
- library(rJava)
- library(ggplot2)
- library(dplyr)
- source("functions.R")
- df <- Get_Data()
Add Comment
Please, Sign In to add comment