Java System Application Development
Add Theme
FlatDarkLaf.setup();
Add Mysql Class
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * * @author pasan */ public class Mysql { private static Connection con; static { try { Class.forName("com.mysql.cj.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jschola", "root", "Java@8828"); // Statement stmt = con.createStatement(); } catch (Exception e) { } } public static ResultSet execute(String query) throws Exception{ Statement stmt = con.createStatement(); if (query.startsWith("SELECT")) { ResultSet resultset = stmt.executeQuery(query); return resultset; } else { int result = stmt.executeUpdate(query); return null; } } }