标题翻译
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();
我有一些考虑,但不知道哪种更有效。
以下是我的选项:
- 在database1中创建一个临时表,并从database2中插入数据。然后批量更新database1中的特定表,从创建的临时表中获取值。
- 使用数据库链接(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 :
- 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.
- Using db link. But I will need the DBA to create the links. Which can take days because of certain approvals needed.
Thank you!
专注分享java语言的经验与见解,让所有开发者获益!
评论