How to create multiple schema connections using Java?(如何使用 Java 创建多个模式连接?)
问题描述
我必须使用两个数据库:
I have to work with two database:
- DB2
- 甲骨文
我在 DB2 数据库中有一个名为 NAVID
的模式.我想使用 Java 为 Oracle 中的所有表创建相同的架构.
I have a schema in DB2 database named NAVID
. I want to create the same schema with all tables in Oracle using Java.
public class automateExport {
static String value;
public static void main(String[] args) throws SQLException, ClassNotFoundException {
ResultSet rs = null;
Connection DB2 = getConnection();
String sqlstm = "SELECT * FROM SYSCAT.COLUMNS WHERE TABSCHEMA NOT LIKE 'SYS%'";
PreparedStatement mainStmt = DB2.prepareStatement(sqlstm);
ResultSet query = mainStmt.executeQuery();
}
private static Connection getConnection() throws ClassNotFoundException, SQLException{
Class.forName("com.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver");
Connection connection =
DriverManager.getConnection("jdbc:db2://localhost:50000/navid","navid","oracle");
return connection;
}
我不知道如何选择所有有列的表并在 db2 中创建相同的表.
I dont know how to select all tables with columns and create the same tables in db2.
推荐答案
为了做这样的事情,我邀请你做多种方法;第一种方法必须选择一个表并获取这些值并将它们复制到一个向量中,第二种方法需要一个参数;向量并获取这些值并将它们插入到第二个数据库oracle"中.如果您想了解任何其他信息,请通过我的 gmail 帐户 zahranemehdi@gmail.com 与我联系.
To make such thing i invite you to make multiple methods; the first method must select a table and get those values and copy them into a vector, and the second method take an argument; the vector and take those values and insert them in the second database 'oracle'. If you would like any other informations contact me in my gmail account zahranemehdi@gmail.com.
这篇关于如何使用 Java 创建多个模式连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 Java 创建多个模式连接?


- Jersey REST 客户端:发布多部分数据 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01