Apache Drill 1.2 and Oracle JDBC

混江龙づ霸主 提交于 2019-12-08 03:44:25

It's working with Drill 1.3 (released on 23-Dec-2015)

Plugin: name - oracle

{
  "type": "jdbc",
  "driver": "oracle.jdbc.driver.OracleDriver",
  "url": "jdbc:oracle:thin:user/password@192.xxx.xxx.xxx:1521:orcl ",
  "enabled": true
}

Query:

select * from <plugin-name>.<user-name>.<table-name>;

Example:

select * from oracle.USER.SAMPLE;

Check drill's documentation for more details.

Note: Make sure you added ojdbc7.12.1.0.2.jar(recommended in docs) in apache-drill-1.3.0/jars/3rdparty

It kind of works in Apache drill 1.3. The strange thing is that I can only query the tables for which there are synonyms created... In the command line try:
use <storage_name>;
show tables;
This will give you a list of objects that you can query - dual is not on that list ;-).

I'm using apache-drill-1.9.0 and it seems that the schema name is interpreted case sensitive and must be be therefore be in upper case.

For a table user1.my_tab (which is per default created in Oracle in upper case) this works in Drill (plugin name is oracle)

SELECT * FROM oracle.USER1.my_tab;

But this triggers an error

SELECT * FROM oracle.user1.my_tab;

SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: Table 'oracle.user1.my_tab' not found

An alternative approach is to set the plugin name and the schema name with use (owner must be upper case as well)

0: jdbc:drill:zk=local> use oracle.USER1;
+-------+-------------------------------------------+
|  ok   |                  summary                  |
+-------+-------------------------------------------+
| true  | Default schema changed to [oracle.USER1]  |
+-------+-------------------------------------------+
1 row selected (0,169 seconds)
0: jdbc:drill:zk=local> select * from my_tab;
+------+
|  X   |
+------+
| 1.0  |
| 1.0  |
+------+
2 rows selected (0,151 seconds)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!