How to insert data from a jsp page into mysql database and run queries on that table , from inside Eclipse?
===

I have the following `JDBC` connection with mysql database : 

    import java.sql.*;
    
    public class Main
    {
        public static void main (String[] args) throws ClassNotFoundException, SQLException
        {
        	
        	Class.forName("com.mysql.jdbc.Driver");
        	
        	String string = "jdbc:mysql://localhost:3306/testdb";
        	
        	Connection con = DriverManager.getConnection(string , "root2" , "root");
        	PreparedStatement statement = con.prepareStatement("select * from names"); // SELECT * FROM `names`
        	ResultSet result = statement.executeQuery();
        	while (result.next())
        	{
        		System.out.println(result.getString(1) + " " + result.getString(2));
        	}
        	
        	
        }
    }


When I go into `http://localhost/phpmyadmin` and create a database , I can run successfully queries on the database the I made there , but how can I do that from inside `Eclipse` (e.g java) ? 

To be more clear, the user enters data into a `jsp` page , and I extract the data 
from there . After that , I want to create a database from inside Eclipse , without going directly into `http://localhost/phpmyadmin` . How can I do that ? 

**EDIT:** 

I have the needed servlets , what I want now is to create the database from the servlet and run the queries from the servlet . 

Thanks 