Question
How do i extract the sql statements required to move all tables and views from an existing database to another database?

Answers

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 the data inside the table. Use the ResultSetMetaData interface.
Execute all DML SQL statements from (8) in the target database.   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q How can I track when my site is added to a user's favorites?
  • Q   Why Drupal needs database? What databases are supported?
  • Q In which cells Mitochondria don’t exist?
  • Q AIDS is caused by a virus known as:
  • Q Explain how can you create a bar-code in crystal reports?
  • Q What happens with the db if you have 'nothing/null' in the option "dbcreate" of your data source?
  • Q Difference between v1, v2, v3 jobs in extraction?
  • Q Richard Adams wrote the novel Shardik what was Shardik
  • Q Define Spiral (Twist) Muscles. Classify them giving examples from upper limb. Enumerate six structures present under cover of pectoralis major muscle.
  • Q What is the Sandbox Solutions?Why we are using that?
  • Q what are the experiment results for a Pea Plant experiment involving Gibberellin and dwarf plants?