oracle想要连接远程数据库,需要配置文件,在tnsnames.ora中进行配置,目录在network/admin下:
ora =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ora是本地实例名,即plsql登录窗口数据库下拉框中显示的名字;
HOST是远程地址,即你要连接的数据库放在那里的ip地址;
PORT是端口号;
SERVICE_NAME是远程数据库实例名。
例如:在jdbc文件中:jdbc.url=jdbc:oracle:thin:@12.0.127.7:1521:ylzft
12.0.127.7是远程地址,1521是端口号,ylzft是远程数据库实例名。
想要连接这个数据库的配置文件写为:
ora =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 12.0.127.7)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ylzft)
)
)
这样,就可以连接远程数据库了。