如何从另一个Oracle数据库进行查询

huangapple 未分类评论48阅读模式
英文:

How to query from another Oracle Database

问题

请问是否有人可以建议我如何从另一个Oracle数据库中查询数据?我需要从我的database1更新表中的某些列,但首先我需要从另一个数据库中获取数据。我正在使用Java传递我的SQL脚本。

StringBuilder query = new StringBuilder();
query.append("SELECT CUSTNAME, CREATEDDATE FROM custtbl");
stmt = connection.prepareStatement(query.toString());
rs = stmt.executeQuery();

我有一些考虑,但不知道哪种更有效。

以下是我的选项:

  1. 在database1中创建一个临时表,并从database2中插入数据。然后批量更新database1中的特定表,从创建的临时表中获取值。
  2. 使用数据库链接(DB Link)。但我需要DBA创建这些链接。由于需要某些批准,可能需要几天的时间。

谢谢!

英文:

Please can anyone suggest how can I query my from another oracle database, I need to update some column in the table from my database1, but first I need to get the data from another database. I'm passing my sql scripts using java.

StringBuilder query = new StringBuilder();
query.append("SELECT CUSTNAME,CREATEDDATE FROM custtbl");
stmt = connection.prepareStatement(query.toString());
rs = stmt.executeQuery();

I have some options in mind but don't know which one is more efficient.

here's my option :

  1. Create a temporary table in the database1 and insert the data from database2. Then batch update certain table in database1 getting the values from the created temporary table.
  2. Using db link. But I will need the DBA to create the links. Which can take days because of certain approvals needed.

Thank you!

huangapple
  • 本文由 发表于 2020年3月16日 12:19:20
  • 转载请务必保留本文链接:https://java.coder-hub.com/60700281-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定