Show and alter oracle table in JSP page using Java
<p>I want to show oracle table list in dropdown menu in JSP, after select a particular table I want to add or delete field on that table.I am trying this in java but couldn't bind it with JSP.</p>

<pre><code>import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class TableCreation {                                                     

 public static void main(String[] args) {
     Scanner scanner = new Scanner(System.in);

 System.out.println("Please provide below details to connect Oracle Database");
 System.out.println("Enter Database");
 String dbName = scanner.next();
 System.out.println("Enter UserName");
 String userName = scanner.next();
 System.out.println("Enter Password");
 String password = scanner.next();
 System.out.println("Enter Table Name");
 String tablename = scanner.next();
 System.out.println("Enter Field Name");
 String columnname = scanner.next();
 System.out.println("ADD Field Name");
 String addcolumn = scanner.next();

 Statement statement;
 Connection connection = null;

 try {

 Class.forName("oracle.jdbc.driver.OracleDriver");

 } 
 catch (ClassNotFoundException e) {
 }

 try {

 connection = DriverManager.getConnection(
 "jdbc:oracle:thin:@172.17.23.25:1521:" + dbName, userName,
 password);

 } 
 catch (SQLException e) {
 }
 if (connection != null) {
 System.out.println("Successfullly connected to Oracle DB");

 try {
     statement = connection.createStatement();
     String tableCreateQuery = "create table " +tablename+"("+
             columnname
             +" varchar2(10))";
 statement.executeUpdate(tableCreateQuery);
 System.out.println("Table Created Successfully");
 String query1 = "ALTER TABLE"+tablename+ "ADD" +
         addcolumn
         + "varchar2(10) ";
 statement.executeUpdate(query1);
 } 
 catch (SQLException e) {
    }
 } 
 else {
 System.out.println("Failed to connect to Oracle DB");
     }
  }
}
</code></pre>

<p>For listing table I use this query</p>

<pre><code>statement = connection.createStatement();
     String tableListQuery = "select table_name from user_tables order by table_name";

     ResultSet rs = statement.executeQuery(tableListQuery);
 while (rs.next()) {

                String tablename = rs.getString("table_name");
                System.out.println(tablename);
            }
</code></pre>