title: How to insert data from a jsp page into mysql database and run queries on that table , from inside Eclipse?
body: <p>I have the following <code>JDBC</code> connection with mysql database : </p>
  
  <pre><code>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));
          }
  
  
      }
  }
  </code></pre>
  
  <p>When I go into <code>http://localhost/phpmyadmin</code> and create a database , I can run successfully queries on the database the I made there , but how can I do that from inside <code>Eclipse</code> (e.g java) ? </p>
  
  <p>To be more clear, the user enters data into a <code>jsp</code> page , and I extract the data 
  from there . After that , I want to create a database from inside Eclipse , without going directly into <code>http://localhost/phpmyadmin</code> . How can I do that ? </p>
  
  <p><strong>EDIT:</strong> </p>
  
  <p>I have the needed servlets , what I want now is to create the database from the servlet and run the queries from the servlet . </p>
  
  <p>Thanks </p>