最近项目中要用到10几个库,为了设计得方便,将多个库都连接到一个库中,这样hinbernate操纵起来方便多了。在一个库中建立其他库的连接语句如下:
create database link pois(连接名)
connect to username identified by password
using 'pois'(远程数据库的网络服务名 )
要完成该操作,username必须有connect权限。
访问该连接对应的数据用如下语句:
select * from t_person@pois
为了方便操作,可以建立如下试图:
create view t_person as select * from t_person@pois
这样以后访问远程连接中的表就可以和访问本地表一样来访问了。