
/* Genomic Comparison Tool
   Master Thesis of computer science

   Author: Yue Lu
   Version: 1.1

*/


/* this class get database connection instance and
	the tables name in all database
*/

import java.net.*;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;


public class DatabaseTableName
{

	//constructor
  public DatabaseTableName()
  {

    try
      {
		  //get the database connection instance
		 DatabaseConnection connection=DatabaseConnection.getInstance();
		 con=connection.getConnection();

		//use the DatabasMetaData to get the names of the tables in the database
         DatabaseMetaData md=con.getMetaData();
		 ResultSet rs=md.getTables(null,null, null, new String[] {"TABLE"});

		 while(rs.next())
		 	Table_Name.addElement(rs.getString(3));

		//rs.close();
      }
      catch (SQLException ex)
      {
		  System.out.println ("9"+ex);

      }

   }

	//reurn the database table names
	public Vector getTableName()
	{
		return Table_Name;
	}


	private String query;
	private Vector Table_Name=new Vector(0,1);
	private Connection con;
}
