圈子推荐
查看所有吧>>
活跃用户
    JDBC FDW

    1.在 oracle 创建表 

    create table emp_fdw(empno int,ename varchar(30)); 

    insert into emp_fdw values(1,'foo'); insert into emp_fdw values(2,'bar'); 

    2.创建连接 

    create server ora_jdbc foreign data wrapper jdbc_fdw options( 

    drivername 'oracle.jdbc.driver.OracleDriver', 

    url 'jdbc:oracle:thin:@//172.16.103.104:1521/orcl', 

    querytimeout '100',

     jarfile '/home/vastbase/bin/ojdbc7.jar', 

    maxheapsize '200' );

    3.新建用户并授权 

    create user use_ora_jdbc password 'Bigdata@123'; 

    grant usage on foreign server ora_jdbc to use_ora_jdbc; 

    4.创建到 oracle 的映射 

    create user mapping for use_ora_jdbc server ora_jdbc options(username 'system',password 'root'); 

    5.创建需要访问的 oracle 中对应表的结构 

    create foreign table emp_fdw_ora(empno int,ename varchar(30)) 

    server ora_jdbc options(table 'EMP_FDW'); 

    grant all on emp_fdw_ora to use_ora_jdbc; 

    6.查看外部表 

    c - use_ora_jdbc 

    select * from emp_fdw_ora;

    • 分享到:
    排序方式:回复时间 共有0条评论