使用sql developer中的信息通过R连接到ORACLE [英] Connect to ORACLE via R, using the info in sql developer

查看:89
本文介绍了使用sql developer中的信息通过R连接到ORACLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在没有管理员权限的计算机上工作.我使用sql developer连接到内部数据库.我也想通过R连接.

I am working on a machine without admin rights. I use sql developer to connect to an internal database. I would like to connect via R also.

没有管理员权限,有什么方法可以做到这一点?有些解决方案要求我设置systemDNS-我不能这样做. 其他需要我安装jvm.dll

Is there any way I can do this, without admin rights? Some solutions require me to set up a systemDNS - which I can not do. Other requires me to install jvm.dll

我的环境:Windows7,sqldeveloper,连接方法是通过TNS文件进行的.

My environment: Windows7, sqldeveloper, connection method is via TNS file.

推荐答案

通过R连接到SQL Developer比我遇到的其他数据库困难得多.重要的是,您必须在计算机上安装jdbc6.jar,并且知道其安装位置的文件路径.安装jar文件不需要管理员权限.您可以从 Oracle网站安装jar文件.

Connecting to SQL Developer via R is far more difficult than other databases I've encountered. It's important that you have jdbc6.jar installed on your machine, and that you know the file path to where it was installed. Installing the jar file does not require admin rights. You can install the jar file from Oracle's website.

我使用RJDBC包进行连接,如下所示:

I use the RJDBC package to connect like so:

    library(RJDBC)

    jdbcDriver <- JDBC("oracle.jdbc.OracleDriver", classPath = "file path to where ojdbc6.jar is installed on your computer")

    jdbcConnection <- dbConnect(jdbcDriver, "jdbc:oracle:thin:@YOUR_SERVER","YOUR_USERNAME","YOUR_PASSWORD")

然后,您可以使用许多命令来测试连接;我通常使用:

You can then test the connection with a number of commands; I typically use:

    dbListTables(jdbcConnection)

我的另一个最爱是在使用数据库时将dbplyr用于类似dplyr的功能:

Another favorite of mine is to use dbplyr for dplyr-like functions when working with databases:

    library(dbplyr)

    tbl(jdbcConnection, "SAMPLE_TABLE_NAME")

结果输出将是来自查询表的数据以小节形式.

The resulting output will be the data from the queried table in tibble form.

这篇关于使用sql developer中的信息通过R连接到ORACLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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