Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I extract the SQL statements required to move all tables and views from an existing database to another database?

0
Posted

How do I extract the SQL statements required to move all tables and views from an existing database to another database?

0

Location: http://www.jguru.com/faq/view.jsp?EID=1185 Created: Nov 21, 1999 Author: Lennart Jorelid (http://www.jguru.com/guru/viewbio.jsp?EID=15) Boy, this is a big one. 🙂 The operation is performed in 9 steps: • Open a connection to the source database. Use the DriverManager class. • Find the entire physical layout of the current database. Use the DatabaseMetaData interface. • Create DDL SQL statements for re-creating the current database structure. Use the DatabaseMetaData interface. • Build a dependency tree, to determine the order in which tables must be setup. Use the DatabaseMetaData interface. • Open a connection to the target database. Use the DriverManager class. • Execute all DDL SQL statements from (3) in the order given by (4) in the target database to setup the table and view structure. Use the PreparedStatement interface. • If (6) threw exceptions, abort the entire process. • Loop over all tables in the physical structure to generate DML SQL statements for re-creating th

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123