我必须使用两个数据库:
I have to work with two database:
我在 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 创建多个模式连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!