
import java.sql.*;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Will
 */
public class DatabaseManagement {
    private static String dbURL = "jdbc:mysql://willsuwei.com:3306";
    private static Connection connection;
    private static Statement statement;
    
    public static void Run(String sqlStatement){
        try{
            connection = DriverManager.getConnection(dbURL, username, password);
            
            String st = "SELECT * FROM world.city;";
            PreparedStatement ps = connection.prepareStatement(st);
            ResultSet rs = ps.executeQuery();
            while (rs.next()){
                System.out.println(rs.getString("ID") +" "+ rs.getString("Name"));
            }
            
            statement = connection.createStatement();
            sqlStatement = sqlStatement.trim();
            /*if (sqlStatement.length() >= 6){
                String sqlType = sqlStatement.substring(0, 6);
                if (sqlType.equalsIgnoreCase("select")){
                    //ResultSet resultSet
                }
            }}*/
        }catch (Exception e){
            System.out.println(e.getMessage());
            e.printStackTrace();;
        }
        
    }
    
    public static void main(String[] args) {
        Run("123");
    }
}

@@ -330,16 +330,110 @@
 :3306%22;%0A
+    private static String username = %22cs3520%22;%0A    private static String password = %22cs3520%22;%0A
     priv

change username password for server