从R连接oracle [英] connecting oracle from r

查看:82
本文介绍了从R连接oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是R的新手,正在尝试使用此处介绍的方法连接到Oracle.

I am new to R and trying to connect to Oracle using the way told here.

我下载了即时客户端,但除了那里的某些.dll文件外,找不到其他东西.

I downloaded instant client but could not find anything apart from some .dll files there.

要求所有人员逐步指导我如何从R连接到Oracle.我看过一些解决方案,但无法解决.

Request all to please guide me step by step as to how to connect to Oracle from R. I have had a look at some of the solutions but they couldnt work out.

请告诉我从R连接到oracle的前提条件. 顺便说一句,我正在使用oracle sql developer.

Please tell me if at all there, the prerequisites to connecting to oracle from R. BTW, I am using oracle sql developer.

推荐答案

如果您已经在桌面上使用的客户端使用JDBC,则使用RJDBC包和使用与桌面包相同的URL可能是最简单的! /p>

If the client that you already use on your desktop uses JDBC, then it's probably simplest to use RJDBC package and use the same URLs that your desktop package used!

library(RJDBC)
drv <- JDBC("oracle.jdbc.OracleDriver",
            "/home/sean/local/DbVisualizer/jdbc/oracle/ojdbc6.jar", "`")
conn <- dbConnect(drv, "jdbc:oracle:thin://localhost/test")
dbListTables(conn)
data(iris)
dbWriteTable(conn, "iris", iris)
dbGetQuery(conn, "select count(*) from iris")
d <- dbReadTable(conn, "iris")

您显然必须更改驱动程序jar文件的路径和连接字符串.

You'll obviously have to change the path to the driver jar file and the connection string.

它可能没有本机驱动程序那么快,但是我发现它更容易上手!

It might not be quite as fast as a native driver, but I found it easier to get working!

这篇关于从R连接oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆