当我尝试连接到Oracle11G DB时,遇到一个错误。我的输出如下。请告知
>Sys.setenv(JAVA_HOME='C:/Program Files/Java/jdk1.6.0_45')
> options(java.parameters="-Xmx2g")
> library(rJava)
> .jinit()
[1] 0
> print(.jcall("java/lang/System", "S", "getProperty", "java.version"))
[1] "1.6.0_45"
> library(RJDBC)
> # Create connection driver and open connection
> jdbcDriver = JDBC(driverClass="oracle.jdbc.OracleDriver", classPath="pathtofile/ojdbc6.jar")
> jdbcDriver
An object of class "JDBCDriver"
Slot "identifier.quote":
[1] NA
Slot "jdrv":
[1] "Java-Object{oracle.jdbc.OracleDriver@9506dc4}"
> jdbcConnection = dbConnect(jdbcDriver,"jdbc:oracle:thin:@//hostname:port/servicename","username","password")
Error in dbConnect(jdbcDriver, "jdbc:oracle:thin:@//hostname:port/servicename", :
unused arguments (jdbcDriver, "jdbc:oracle:thin:@//hostname:port/servicename", "username","password")
我不确定这是否是你想要的答案,但这就是我建立连接的方式:
library(RJDBC)
drv <- JDBC(driverClass="oracle.jdbc.OracleDriver", classPath="pathtothisfile/ojdbc6.jar")
conn <- dbConnect(drv, "jdbc:oracle:thin:@//Hostname:Port/SID", "username", "password")