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 创建多个模式连接?
基础教程推荐
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 降序排序:Java Map 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01